Two people's hands playing Rock Paper Scissors with CHARGE power packs and micro:bits attached to their wrists.

Introducing Rock Paper Scissors (RPS)

Rock Paper Scissors is a simple hand game where two people shake their fists three times and then reveal either Rock ✊, Paper ✋, or Scissors ✌️ using their fingers to indicate which choice. To win, choose the choice that “beats” the other player: Rock breaks Scissors, Scissors cut Paper, Paper covers Rock. In this project, we’re going to leave the fate of our choice in the hands of the micro:bit! 

What you need:

With CHARGE for micro:bit

  • 2x micro:bits (V1 or V2)
  • USB cable
  • Chromebook, laptop, or desktop
  • Access to MakeCode
  • 2x CHARGE w/ wrist strap

Without CHARGE

  • 2 micro:bits (V1 or V2)
  • USB cable
  • Chromebook, laptop, or desktop
  • Access to MakeCode
  • Power bank or battery pack
  • Wrist strap, clips, tape, elastic bands

Code your Step Counter:

  1. Open makecode.microbit.org
  2. Input drawer: add “on shake”
  3. Variables drawer: “Make a Variable” and name it something like choice
  4. Variables drawer: add “set choice to 0” to “on shake”
  5. Math drawer: grab “pick random 0 to 10” and drop it onto the 0 in “set choice to 0” 
  6. Logic drawer: add “if <true> then, else” block under the “set” block
  7. Logic drawer: grab “0 = 0” comparison block and drop it onto <true>.
  8. Variables drawer: grab the choice variable and drop it onto the first 0, it should now say “choice = 0”
  9. Basic drawer: add “show icon [heart]” and change the heart to whichever icon you think best represents a rock. 
  10. Copy & paste the “choice = 0” block into the <false> in “else if <false> then.” Then change the 0 to 1.
  11. Copy & paste the “show icon” block into the else if statement. Then change the icon to whichever icon you think best represents a piece of paper.
  12. Paste the “show icon” block again and place it in the else statement. Then change the icon to whichever icon you think best represents a pair of scissors. 
  13. Plug in your micro:bit, pair, download your code. Then plug in the other micro:bit, pair, download and test!

Or experiment with the finished code here:

Use the RPS Program:

Now find a partner to play Rock Paper Scissors with! Fasten the micro:bit to your arms with the CHARGE power pack or another DIY way and start playing! Simplest way is to make a fist with your micro:bit arm, bring your fist down onto your other hand to catch it.

You might notice that you have to be slower or more intense with your shakes for the micro:bit to detect it and change.

Make it better:

Unsure if the choice was the same as the last or it didn’t register your shake? Consider adding a noise once it has chosen or clearing the screen after each round. Want to make your own icons? Try using the “show LEDs” block in the Basic drawer. Want to make the game more exciting? Maybe add some flair when you win or keep track of how many times you win. Consider making the program only choose after the 3rd shake, like an actual game.