13. Case 10: Finger-guessing game¶
13.1. Purpose¶
Use the Smart Coding Kit to create a finger-guessing game
13.2. Products Link¶
13.3. Software¶
13.4. Programming¶
Step 1¶
Set both the variables “i” and “k” as 0 and show the on start icon
Set the wireless group
While pressing button A or/and B, set the variable “k” as the equivalent number and send it to show the icon accordingly
After receiving the data, save the data as variable “i”
Step 2¶
In the Forever block, judge the value of “i” and “k”, if they are not 0, it means both the players give a “fist” The winner will be judged by the comparasion of “i” and “k” Set both the varibles “i” and “k” as 0 and be prepared for the next round
13.5. Result¶
Choose to give a “fist” through button A or/and B, the results will be given accordingly, the winner has a smile face and the loser has a cry face on the micro:bit.