top of page

Rock Paper Scissors Game

Lesson Overview

In this lesson, students are required to use Scratch to design a game in which two players automatically play rock-paper-scissors and must record the results. During the design of the game, students have to find a way to simulate playing ‘Rock’, ‘Paper’ and 'Scissors' and to be able to determine the winner of the game. The aim of the game is to help students understand the meaning of simulation (i.e., we can use numerals to simulate real situations, e.g., ‘1’ = ‘rock’, ‘2’ = ‘paper’, ‘3’ = ‘scissors’) and to understand the mathematical concept of probability by observing the outcome of trials in the game.

Prior Knowledge

  • Mathematics: Inequality

  • Scratch: Know how to use blocks such as ‘ask’, ‘forever’, ‘repeat until’, ‘if… then…’, set variables, and change size and costume.

Learning Objectives

  • To understand the role of each Sprite, i.e., Cat: Control the game and record the results; Player 1 and Player 2: Change costumes.

  • To understand how to express ‘Rock’, ‘Paper’ and ‘Scissors’ in Scratch, i.e., using numerals: ‘1’ = ‘rock’, ‘2’ = ‘paper’, ‘3’ = ‘scissors’.

  • To understand how to simulate playing ‘Rock’, ‘Paper’ and ‘Scissors’, i.e., set player 1 and player 2 to pick random 1 to 3.

  • To understand in what condition(s) would each event occur? e.g. Under what circumstance(s) would Paper win? How about that for Player 1 to win?

  • To understand the probability of the different events in the rock-paper-scissors game: Rock win; Paper win; Scissors win; Player 1 win; Player 2 win and Draw.

  • To understand how to check if a number is a positive integer or not (e.g., using function ‘round’ or ‘floor’).

Mathematics & CT Outcomes

  1. Mathematics: concepts of probability, examination of a positive integer (e.g., using function ‘round’ or ‘mod’).

  2. CT Skills: stimulation, conditionals (if…then…), loops (repeat until…; forever), variable (set XX to XX; change XX by XX), operators (and; or; pick random XX to XX).

Teaching Resources 

The Desmos Activity used in this Task.

Lesson Details


Create a simple game together with the whole class. Requirements for the game are as follows:

  1. The cat will walk from left to right.

  2. The cat can change size.

  3. The cat must appear at the left centre every time we start the game.

  4. We need to visualize the motion of walking.

Now try to design a game to automatically play the rock-paper-scissors game for 2 players, results have to be recorded. 

Click Remix:

Extension Question

  1. What will you do in the program to enhance the game? E.g., a 3-player game, or a best-of-3 game?

  2. If we play the game 1000 times instead of 100 times, what do you expect to observe? What can you conclude?

  3. Is there a winning strategy in playing this game (Rock-Paper-Scissors)? Why or why not?

Students' Work

(1) Most students can use numerals to stimulate ‘Rock’, ‘Paper’ and ‘Scissors’ in Scratch, i.e., ‘1’ = ‘rock’, ‘2’ = ‘paper’, ‘3’ = ‘scissors’. 
Figure 1.png
Figure 2.png
(2) Students can use different ways to judge the winner of the game
Method 1: 

In this work, judgements are made by judging Player 1’s choice first and then Player 2’s choice. The judgement of the game situation is divided into three main categories based on Player 1’s choice: P1 choice = 1, P1 choice = 2 and P1 choice = 3. In each case, the judgement is then made in turn with Player 2’s choice.

Figure 3.png
Method 2: 

Another way is to list all 9 possible situations for both players and then divide them into 3 categories with player 1 winning, player 2 winning and a drawing.

Figure 4.png
Figure 5.png

Possible Challenges and Misconceptions

(1) Difficulties in coordinating multiple Sprites to perform tasks at the same time
Figure 6.png

In this work, the student only coded the sprites cat and did not set up costume changes for another two sprites (i.e., player 1 and player 2). Therefore, the program is unable to match the rock-paper-scissors look to the simulated numerals (i.e., 1, 2, 3). In addition, students may also have difficulties with setting up loops for repeated trials and misunderstood the usage of blocks such as [repeat until] and [if…then…].

(2) Wrong way to determine the winner of a game
Figure 7.png

In this work, rock-paper-scissors is modelled using the numbers 1, 2 and 3 respectively, and random blocks are used to simulate a random choice of players. However, there are errors in the conditions for determining the winner, such as “if player 1 > player 2, change player 2 win by 1”. For example, if player 1 plays ‘Paper’ (3) and player 2 plays ‘Rock’ (1), then player 1 > player 2 is satisfied, but player 1 wins.

Figure 8.png
(3) Did not test whether the number of trials entered was a positive integer
Figure 9.png

As part of this game, the question-and-answer session needs to be set up and the answer determines how many times the game is played. However, most students forget to check that the number entered is a positive integer. It is possible to test whether a number entered is valid by using [answer > 0] to determine that the number is positive and also using blocks such as [round/floor/ceiling] to determine that the number is an integer.

Students' Reflections

Q1: What did you learn about programming today?

  • I have leant how to use repeat until.

  • List, variables, operators, making an automatic calculator.

  • Random number blocks.

  • I learned that programming can be used to solve math questions that would have to be trial-an-errored.


The author would like to thank Ka Ying LIU for designing this lesson and appreciate all the anonymous teachers and students who participated in this research.

bottom of page