The math game we are creating in grade Six allows me to do a better job of teaching input statements, concatenation and use of variables. The other thing I like is that it also allows me to differentiate and look at recursion. The user answers an addition question and through an if else statement the user answer is compared to the correct answer and feedback is given. The game uses three variables. Two variables create two random numbers and the third adds the two random numbers.
The next step will be to create two more sprites that will change costumes depending on the random number generated. For example, if the first number generated is a five then five circles will appear. This is done by changing the sprite costume. At first I used a series of if statements to pick the sprite costume that corresponds to the random number. Some students picked this up fairly quickly so we looked at how the same thing could be done with recursion.
This code uses a custom block that calls itself. It increments a new variable (step) until it is equal to the randomly generated variable. When the two numbers are equal the loop stops and the costume is set to display the correct number of items.