Counting game and virtual coin toss game
The beginners developed a little game that counted how many times they could push a button in 3 seconds. Once they programmed this and had it working they were allowed to cheat. Cheating involved finding as many modifications as possible that could be made to the code in order for it to count faster. This program involved concepts such as loops, variables, decisions and incrementation.
The original code looked as follows. You can ask the kids to explain to you the modifications they made in order to make it count faster. There are 6 relatively easy modifications that can be made, after that it gets a little harder.
Virtual coin toss game.
The advanced kids developed a game that simulates a coin toss. So they could choose head and tails and the program would randomly decide whether to choose heads or tails. This program is deceptively complicated and requires a good understanding of logic processes. It covers concepts such as variables, decision logic and random chance. Here are some code snippets. The complete image of the code is too large to capture so I’ve included the important bits below.
Selection of Heads or Tails.
Random selection of Heads or Tails by the robot.
Logic operation to determine if the player won or lost. (This is not entirely trivial)