MB4: Choose a Teammate
MAKECODE
Diagram

Code

Player A: Each player has a number associated with them that will be used when passing or receiving the ball, this will be called the jersey number. Player A's number is 0. Additionally, we have a variable Ball that can be either true or false (a boolean data type) to represent whether or not a player has the ball.
On start the radio group is set to a number and Ball is set to false. It is important that all players on the same team are in the same radio group in order for the micro:bits to communicate via radio with one another. When the micro:bit screen is turned to face the floor, this allows a player to start with the ball and changes the Ball variable to true.
On A and B button presses, the player that will be receiving the ball is selected based on their jersey number. By convention A is for the lower jersey number of the two teammates to avoid confusion when playing. On shake, the code checks if Ball is true and, if so, sends the jersey number of the player chosen to receive the ball before clearing the screen and changing the Ball variable to false.
When the micro:bit recieves a radio signal that contains a number, it checks if the value is their own jersey number. Player A checks if they receive 0 and if so, will change Ball to true and have it appear on the screen.
Code avaialble here

Player B: As described in the code for player A, each player has a jersey number. Player B's number is 1 but it can be modified as desired. The code is very similar to Player A's with a few value differences. On A and B presses, players 0 and 2 are now the ones that can receive the ball. It is important that neither of these values are 1 because that is Player B's jersey number and we do not pass the ball to ourselves. As with Player A, if Ball is false and the number 1 is received then the ball is passed to Player B.
Code available here
Player C: As described in the code for player A, each player has a jersey number. Player C's number is 1 but it can be modified as desired. The code is very similar to Player A's with a few value differences. On A and B presses, players with the numbers 0 and 1 are now the ones that can receive the ball. It is important that neither of these values are 2 because that is Player C's jersey number and we do not pass the ball to ourselves. As with Player A, if Ball is false and the number 2 is received then the ball is passed to player C.
Code available here
Game

Hot Potato | 3 players* | 1 micro:bit per player
In order to build off choosing which teammate to pass the ball, a game of Hot Potato can be created. Instead of using a boolean, this code changes the value of Ball to a number that will decrease each second, acting as a timer. Once the timer from the Ball variable reaches 0, the ball explodes and the game is over. When a player starts with the ball a random number will be generated to determine when the ball will explode. On shake, the micro:bit will send both the letter of the player it chose as Teammate and the time remaining in Ball via radio to pass the ball. These values are sent together and received together and the ball will only be passed to a player if they receive their player letter along with a number representing the time left.

The game starts when 1 player faces their microbit to the floor to obtain the ball. The timer counts down each second as the ball is being passed around. Once the timer reaches 0, the ball explodes and the game ends.
Code available here
*Note: The code needs can be altered for more than 3 players. This can be done by having the A and B buttons increment through a list of all the players.
Code available here
ARTBIT
Diagram
