02.
Step 2: Select 'Continue with Google'.
03.
Step 3: Select your school account.
04.
Step 4: Select 'Continue'
05.
Step 5: Select 'New Project' and name your project "Rock Paper Scissors"
06.
Step 6: Select any existing blocks and delete these.
07.
Step 7: From the toolbox, select the Input category and drag the block 'on shake' into the work area.
08.
Step 8: We now need to make a variable to keep track of whether we have a Rock, Paper or Scissors in our hand.
Click on the Make a Variable button. Give your new variable the name “hand” and click Ok.
09.
Step 9: Click on the Math category in the Toolbox. Drag a pick random block and drop it into the set hand block, replacing the number 0 with 1 and 10 with 3.
Now when we shake our micro:bit, the variable hand will contain a random number between 1 and 3.
10.
Step 10: Click on the Logic category in the Toolbox. Drag the 'if true then else' block out to the workspace and drop it into the on shake block under the set hand block.
11.
Step 11: Click on the Logic category in the Toolbox. Drag a 0 = 0 comparison block and drop it into the if true then else block replacing true.
12.
Step 12: Click on the Variables category in the Toolbox. Drag a hand block out and drop it into the 0 = 0 comparison block replacing the first 0.
Click on the second 0 in the comparison block and change to 1.
13.
Step 13: Click on the Basic category in the Toolbox. Drag a show icon block out and drop it under if hand = 1 then.
In the show icon block, click on the Heart icon and instead select the small square icon to represent a 💎 Rock.
14.
Step 14: At the bottom of the if then else block, click on the plus ‘+’ sign. This will expand the code to include an else-if clause.
15.
Step 15: From the Logic category, drag a 0 = 0 comparison block and drop it into the open space next to the else if clause.
16.
Step 16: Click on the Variables category in the Toolbox. Drag a hand block out and drop it into the 0 = 0 comparison block replacing the first 0.
Click on the second 0 in the comparison block and change to 2.
17.
Step 17: From the Basic category, drag a show icon block out and drop it under else if hand = 2 then.
In the show icon block, click on the Heart icon and instead select the large square icon to represent 📃 Paper.
18.
Step 18: Now let’s deal with the last condition - if our hand variable isn’t holding a 1 (Rock) or a 2 (Paper), then it must be 3 (Scissors)!
From the Basic category, drag another show icon block out and drop it into the last opening under the else. In the show icon block, click on the Heart icon and select the Scissors icon.
19.
Step 19: Let’s test your code! Press the white SHAKE button on the micro:bit on-screen simulator, or move your cursor quickly back and forth over the simulator.
Do you see the icons for rock, paper and scissors randomly appear? ⭐ Great job! ⭐