Eh, everybody might heard of the “rock scissors paper” game: it is a hand game,¬†usually played between two people, in which each player simultaneously forms one of three shapes with an outstretched hand. These shapes are “rock” (a closed fist), “paper” (a flat hand), and “scissors” (a fist with the index finger and middle finger extended, forming a V).

A player who decides to play rock will beat another player who has chosen scissors (“rock crushes scissors”), but will lose to one who has played paper (“paper covers rock”); a play of paper will lose to a play of scissors (“scissors cuts paper”). If both players choose the same shape, the game is tied and is usually immediately replayed to break the tie.

Lets play this game using a Micro:bit board!

Will have to set the “on shake” event when to choose the sign, and display the sign on the led matrix.

Use the online editor https://makecode.microbit.org/#editor to make the program.

First clear the screen, set a variable “hand_sign” with a random value from 1 to 3 (1-scissors, 2-rock, 3-paper);

Then for the corresponding sign, draw an image

Here is the gameplay on the simulator:

Use the following JavaScript code in the editor if you are lazy to make the sketch from zero:

I’ve added some fancy stuff on start event:

 


Get your fun toy:

Micro:bit fun: rock-scissors-paper game
Tagged on:     

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.