This is a variation of the counter sample where we increment by a random number instead of just 1. This is a fun program to pratice times table.
The variable Y
is used to hold the random multiplier and the variable X
is used for the counter. Every time the user presses A
, we add X + Y
and store it in X
.
- when shake, do set variable X to random number between 1 and 10 .
- when variable X changed, do set variable
X
to get variable Y variableY
- when press button A, do set variable
X
to variableX
plus variableY
- when variable X changed, do show variable
X
value.