Rock Paper Scissors With Multiple Micro Bits!

by nah im tweakin in Circuits > Microcontrollers

530 Views, 2 Favorites, 0 Comments

Rock Paper Scissors With Multiple Micro Bits!

Pastel Scribbles Presentation (2).png

I made rock paper scissors on a micro bit. but not just some ordinary rock paper scissors for 2 poeple but for as many poeple as you want!

Supplies

Pastel Scribbles Presentation (1).png

there aren't much things that you'll need for this project to work, the only things that you need are:

  • 3 micro bits
  • 3 or more usb ports to power the micro bits

Make Some Variables and Define the Starting Values

Knipsel.PNG

When you start the programme on the main micro bit it should set it's radio to a group of choise so it's able to send a signal to the other players. You should also define the starting values of your rock paper and scissor variables, it can be any value of choise over 3.

Make the Rock Paper and Scissor Inputs

2.PNG
3.PNG

for the inputs you have to make the buttons do something, lights are the firts thing you should make, they are essential for showing what choise you made. next set the values on 1 if the button is pressed and make a new value called players (wich will be important later). When the button is pressed the players variable should go up with one. next just pause it for a second and let it reset the screen.

The Main Mechanism of the Game

4.PNG

Here comes a big one! for the multiple player feature to work you should add a block of code that checks if the required amount of players is met. It is possible to play with as many players as you want by changing the required value of players needed to execute the next block of code. Next you need to add 3 blocks of code that do the following things: check if two of the three rock paper scrissors variables have the same value, send a radio signal that can be any number above three, show what object won in text and reset the values of all variables to the starting ones. And finally the last block of code that you should make is one for a tie. It's basically the same as the previous blocks but just checks if the rock paper and scissors variables have the same value instead of just two variables.

Final Step for the Main Game

6.PNG

this last block of code is used to receive the choise from the 2 or more other players. it should check if the values received are a rock paper or scissor and put it in the game.

Make a New Project for the Second and Third Player

7.PNG

this should do three things:

  • go on the same radio group as player1 (the first project)
  • send a signal to player 1 of your answer
  • receive the end results

Final Step: Download and Play

For the game to actually work you have to put your first project in ONLY 1 micro bit. You put the second project in all of the other micro bits and thats it. ENJOY!