The teacher demonstrates the MakeCode blocks for storing a random number from 0 to 2 in a variable and using if, else if and else to choose what the LEDs show. Each student designs their own 5 by 5 LED picture for rock, paper and scissors, then codes the board so that shaking it picks a number at random and shows the matching picture. They test in the on-screen simulator, download the program to their micro:bit and play best of five against a classmate. To finish, they write two sentences explaining why the game is fair, using the fact that 0, 1 and 2 are equally likely.
Tools: micro:bit, MakeCode Nine ideas for your own version in Generate
This page is one of a growing set of PICRAT examples by cell, subject and grade. Page maintained by Andy Perryer.