Scratch 101: Turbo Mode


Welcome to this Scratch 101 Lesson about the "Turbo Mode" feature and how to evaluate its effectiveness. 

What is Turbo Mode?

In Turbo Mode, all scripts run to their maximum potential (as quickly as they can) based on a number of factors related to your processor and other aspects of hardware. This can help increase the rate at which your computer performs calculations, yet it can also degrade the performance of projects which rely heavily on built-in graphics components because of the increased memory requirements. 

Enabling Turbo Mode:

To use Turbo Mode you must hold down shift and click the green flag. If done successfully you should see the words “Turbo Mode” in orange text to the left of the green flag as shown in the image below.


Project Template: 

A pre-made template can be found here: https://scratch.mit.edu/projects/236419105/

Our Project:

We will evaluate the effectiveness of Turbo Mode by testing how quickly it can repeat a "blank" command (i.e. the call has no purpose or output which affects our program). If it runs in under 1/10 of a second, our "Turbo" variable will be set to "true" to indicate that our program is running at our desired speed. Otherwise it will be set to false.


Explanation:

1.) “When Green Flag Clicked Block” - This is our event handler and connects the rest of our program with the green flag found in the player.


2.) “Reset Timer Block" - A built in command call which resets the timer in the player.


3.) "Useless Code Sequence" - An iterative loop which runs a blank call ten times to waste some runtime. How quickly the program in "turbo mode" can get through this will help evaluate its effectiveness.


4.) "The Final Test" - If the program runs longer than 0.1 seconds then turbo mode is off (based on the expectation that "turbo mode" in effective) and it will set the variable to false and if it the program runs faster than 0.1 seconds then turbo mode is on (we presume) and then the variable will be set to true.


Method-Based Hierarchy:

We can also separate the turbo mode test from the original event handler to build a method which can be integrated into other programs quite easily. Projects which require a faster rate of calculation will usually integrate this test to ensure that the user has turbo-mode on to ensure a better experience. Methods are easier to integrate because they streamline the code and separate out the different "functions (purposes)". 


Completed Projects:

Completed Project (No Method): https://scratch.mit.edu/projects/236419745/

Completed Project (with Method): https://scratch.mit.edu/projects/236419587/

This post was in part contributed by jakel181 with heavy revisions. 

2 comments: