Micro:bit Finger-guessing Game

Hello, today I am going to build a finger-guessing game with the micro:bit. If we shake the micro:bit, the micro:bit displays the scissor, stone or cloth at random, then we can play it with our partners.
The GIF Image:
Principle:
The working principle is very simple---detecting the vibration event from the micro:bit: while the micro:bit is shaken, a random number from 1~3 is generated. We can program the numbers coinciding with the graphics of 1 as stones; 2 as scissors and 3 as clothes. I’d like to describe them with the graphics below:
Program
Blocks used:
· Shaking event: on shake
· Display LED show leds
· Numbers generated at random: pick random 0 to 10
· Judgement
·if then/else if then/else
· Varaibles
1. Go to MakeCode: (https://makecode.microbit.org/) and create a new project.
2. Choose the on shake block.
3. Create a new variable and name it as “hand”.
4. Set the value of “hand” as a random number from 1~3.
5. If hand = 1.
6. Display stone.
7. Click to add choices.
8. Display cloth.
9. Click to add another choices.
10. If hand = 2
11. Display scissor.
Completed code:
Link: https://makecode.microbit.org/_8cVeyoEU39XA
If you have any ideas or opinions, please feel free to contact us via services@elecfreaks.com.
Share this post
About the Author

ELECFREAKS focuses on microbit and publishes interesting articles
Related Posts
Introduction to the history of the BBC micro:bit
New BBC micro:bit-micro:bit V2
How to make a meme with micro:bit ?
Topics
- Curriculum
- Course
- Micro bit supplier
- Wholesale Suppliers
- Micro bit tutorial
- Micro bit classroom pack
- Mcorbit Environment Monitoring
- Temperature-controlled
- Motor
- Fan
- TPBot car
- TPBot
- Micro:bit car
- AI Lens
- Micor:bit AI Lens
- Micro:bit LEDs
- BBC micro:bit
- Micro:bit Manipulator
- Wukong board
- Cutebot
- Micro:bit Motorcycle
- Nezha breakout
- Micro:bit DIY
- 360° servos
- AI Lens
- Retro Arcade
- Ecode
- PlanetX
- Microbit programming
- Your:bit
- Do your:bit
- IoT:bit
- Octopus
- Rainbow LED Ring
- Joystick:bit
- Wonder Building Kit
- Sensor:bit
- Downie
- Wenjie
- Laser Engraver Tutorial
Tags
Comments