en:instructions:rockpaperscissors

A digital version of the Rock-Paper-Scissors version allowing you to play against each other or against the computer.

To program this example you need to use the buttons, the matrix, variables, logic, and math.

You can program the game progressively. For each step, add the displayed blocks and put them in the right order. You can then test your program by clicking on .

#### Step 1: Showing a number when a button is pressed

• You will say to Kniwwelino: « If I press button A then write “1” on the matrix ». Use the following blocks and add them to `Kniwwelino loop forever`:

#### Step 2: Showing a random number when a button is pressed

• You will say to Kniwwelino: « If I press button A then choose a random number between 1 and 3 and write this number into a variable named `value` ». Add the following blocks to your program:

• After Kniwwelino chose a random number between 1 and 3, you will say to Kniwwelino: « Show the variable `value` on the matrix ». Remove the `1` and replace it with `value`:

#### Step 3: Showing different images for the numbers 1, 2, and 3

Instead of writing the number in `value` to the matrix, you will now say to Kniwwelino: « If the number in `value` is equal to `1`, then show an image (e.g. a rock). If it is equal to `2`, then show another image (e.g. a paper). If it is equal to `3`, then show a third image (e.g. scissors).».

• Delete the block writing the number

• Replace it with your first condition made of the following blocks.

• Repeat the previous point for the two other conditions.