BBC micro:bit
Rock, Paper, Scissors


Rock, Paper, Scissors is a hand game played by two people. Each person makes one of three shapes with their hand at the same time. If the players both throw the same shape, then the round is drawn. If the shapes are both different, then one shape always beats another according to the following diagram.

Rock, Paper, Scissors

The game is very simple but has some interesting characteristics. It's hard to make a genuinely random choice and, whether you think about it or not, patterns tend to emerge in the choices you make. The micro:bit provides you with a way to see what happens if the choices of one or both players in the game are more random than a human being can make them.


This program displays a smiley face when shaken and then, after one second, displays one of the letters 'R', 'P' or 'S' to represent the three choices.

micro:bit Code


  1. The program could do with some improvements to the way that the choice is displayed. It is quite easy to make this more realistic. When the player shakes the micro:bit, display an image on the matrix and then pause for a couple of seconds (pause 1000 = one second). Then display and 1, pause for a second, display a 2, pause for a second, display a 3, pause for a second. Then it is time to display the letter that corresponds to the shape chosen.
  2. Go a little further with the display design and work out a suitable animation to show each time you shake the micro:bit. Remember to leave a little time after the shaking so that you get to see the animation properly.
  3. Design an experiment to investigate the impact of random choices. Think about playing the game normally with a person for a number of rounds. Then take turns at using the micro:bit to choose. Finally, play two micro:bits against each other. Play the same number of rounds for each match. Before you start, design a way of keeping a record of each match. A spreadsheet would be a good way to do this. You could quite easily record each round and then see if human players choose one of the shapes more often than the others.
  4. If you were an umpire or referee for a game of Rock, Paper, Scissors, you could use a micro:bit to keep track of the score. You could press the A button to score a round to Player 1 and the B button to score a round to Player 2. Make 2 variables, one to keep track of each player's score. Set them to 0, connecting the blocks together in the script window but leaving them by themselves. Grab blocks for handling the A and B button press events. Change each of the player's scores in the corresponding button events. You also need to check if they have reached the match winning total. If they have, display a message on the screen to report their victory. You could reset the scores to 0 when both buttons are pressed at the same time.
  5. Look again at the game rule diagram at the top of the page. Notice that each circle connects to the other two. If you want to extend the idea of the game to have more 'shapes', you need to make sure that each shape connects to every other shape. It's easiest to plan this with a diagram. The names of the 3 shapes in the classic game were arranged in a triangle in the diagram, a shape that has 3 sides. If you want 4 choices in your game, arrange your shapes in a square (4 sides), for 5 shapes, a pentagon and so on. If you get away from the idea of shapes that you can make with your hands, you could instead look at objects that are easier to represent on a 5x5 grid of pixels. If you like the role playing element, then use letters to represent your characters. Use an odd number of characters and make sure that each character wins and loses against the others the number of ways. Program the micro:bit to play the game. Play against it or use it to make your choices in a game against another person.