After a win: if scores[0] = 3, send 3 and show Champion; else start the next round.
Another hint
When 3 arrives: show Game over. A function newTournament sets scores back to [0, 0]; call it on both sides.
First to three wins the tournament: send 3, both sides show the result, and the scores reset.
This ticks by itself when your blocks do what is asked.
ModifyChange the code on purpose and check the result.
Run a class tournament
With real micro:bits, run a knockout: each pair picks its own group number, winners move on and play each other. Ideas to make it yours: first to five, a sound for the champion, or showing the scores after every round on both sides.
Try it yourselfYour edits are saved in this browser.
It takes a few seconds to load. Your work in this step is kept.
Lesson done. You've finished every step you need.
Now you can
Keep a scoreboard in a list and update the right place.
Move a sequence into a function and call it from two places.
An optional, harder extension of the Radio duel. Students keep a two-place scoreboard list, move a round into a function so rounds carry on, and end the tournament at three wins. About 60 minutes.
I can keep a scoreboard in a list and update the right place.
I can move a sequence into a function and call it from two places.
I can end a game with a target, a message and a reset.
Before class
This lesson is optional: it is for students who finished the Radio duel and want a harder challenge. It needs nothing new. The scoreboard is a list of two numbers: place 0 is this micro:bit's player, place 1 is the other player. Because both micro:bits run the same program, each one sees the match from its own side (2 - 1 on one is 1 - 2 on the other). Adding a point uses set value at 0 of scores to (get value at 0 of scores + 1). Milestone 2 moves the round into a function startRound, so the winner's micro:bit can start the next round by itself. Milestone 3 adds message 3 (champion) and a reset.
Running the lesson
Predict: 2 - 1. Ask which place is 'you'.
Investigate: the 'two sides' question is the key idea: same program, different point of view.
Milestone 1: two set value blocks, one in A (win) and one when 2 arrives (loss).
Milestone 2: moving blocks into a function, then calling it twice, is the same move as Milestone 1 of the duel.
Milestone 3: goals only. Ask pairs to agree what message 3 means before building.
Class tournament: real micro:bits make this a great end-of-unit event.
The hard part (on purpose)
Each micro:bit keeps itself at place 0, so the two scoreboards are mirrored. Ask which place a win and a loss each add to.
When students get stuck
Both scoreboards count the same player's wins. Ask: Which place does a loss add to? Fix: A win adds at place 0; a loss (2 arrives) adds at place 1.
Rounds stop after the first one. Ask: Where is startRound called after a win? Fix: Call startRound at the end of the winning branch in A.
The scores do not reset after a champion. Ask: Do both sides reset? Fix: Set scores to [0, 0] on the champion's side and when 3 arrives.
Stretch and support
Stretch: Keep a list of round times as well, and show the fastest reaction of the tournament on the champion's micro:bit.
Support: Students who find this heavy can stop after Milestone 1: a working scoreboard is a good result.
Where it leads
This ends micro:bit Foundations. Robotics challenges comes next: each idea in the simulator, then on a real MOVE Motor. Class ideas: a class knockout bracket on the board; a rematch where students change one rule and explain why it is fairer.
What each step is for
Investigate: Both micro:bits run the same program, so each keeps its own player at place 0: the two scoreboards show the same match from opposite sides.
Milestone 1: keep score: Each event updates the right place in the list: a win adds to place 0, a loss to place 1.
Milestone 2: the next round: Moving a sequence into a function lets a second event reuse it, so the game can carry on without a button press.
Milestone 3: champion: Ending a tournament joins every idea: a list item compared with a target, a new message in the code, and a function that resets the state.