# Rock Paper Scissors Activity

Make a cool Rock Paper Scissors game in this activity!

• 대상 연령 8+
• 30 예상 시간(분)
• JavaScript Blocks

## 소개

This project teaches you how to create a game of rock paper scissors using the "random" block and the LEDs.

## 활동

8 steps

### Step One

We want the micro:bit to choose rock, paper, or scissors when you shake it. Place a on shake block so when you shake the micro:bit, it will run part of a program.

### Step Two

Add a weapon variable to store a random number computed with pick random.

When you shake the micro:bit, it should pick a random number from 0 to 2 and store it in the variable weapon. (This variable is named weapon because rock, paper, and scissors are the weapons you use to battle your friends!)

In a later step, each of the possible numbers (0, 1, or 2) is matched to its own picture. The picture is shown on the LEDs when its number is picked.

### Step Three

Place an if block under the pick random and check whether weapon is equal to 0.

### Step Four

In the if block, place a show leds block that shows a picture of a piece of paper.

### Step Five

Add an else if block to the if block and check whether weapon is equal to 1.

Click on the gearwheel icon to open up the if editor; then drag and drop an else if block in the if editor.

### Step Six

Place a show leds block under the else if and draw a rock image on the screen.

### Step Seven

Add a show leds block with a picture of scissors to the else part.

You don’t need to check if weapon is 2 because 2 is the only number left out of 0, 1, and 2. That’s why you can use an else instead of an else if.

### Step Seven

Your game is ready! Gather your friends and play Rock Paper Scissors!

## Challenge

Try to add the following functionality:

• Display animations for the different options
• Change it for Rock Paper Scissors Spock Lizard

## 더 알아보기

The 'Magic Button' activity introduces inbuilt sensors, teaching you how to measure magnetism.