The Flu Game

Inspired by the totally awesome Hannah Fry’s BBC Four programme on pandemic flu and this also awesome micro:bit project, I present: The Flu Game.

You will need:

  • more than 2 micro:bits with battery packs
  • a way of flashing Python code (or hex files) to the micro:bits – this can be Mu, the online editor or, in the case of the hex files, pretty much any computer.
  • 1 human being per micro:bit

This is a very much simplified version of the Microsoft make code Infection project. Simplified for two reasons: I wanted it to be cross-platform, not just Windows.* And I want to use it in my primary school Code Club, so the code should be easier to understand and quicker to type in.

[* CORRECTION: I am grateful to my correspondent who points out that MakeCode is cross-platform - I was getting muddled because some of the MakeCode projects do require the Windows app, but the Infection game does not.]

Get a bunch of kids or adults in a reasonably large space. Flash the program on to all the microbits, unplug from the computer, connect the battery packs and they should all see smiley faces. The person running the game asks to ‘check’ some of the micro:bits and sneakily presses A and B together on one of them. This becomes PATIENT ZERO. Get everyone to run, move around, have a chat, interact in whatever way seems normal.

Patient Zero is contagious but does not know it – their micro:bit still shows a smiley face – but they are now transmitting the word ‘virus’ by radio, but at a very low power. You need to be quite close to them to catch the virus – about a metre away when I was testing in my kitchen. (You can uncomment a line in the code to show a confused face when you are contagious which is useful for debugging, checking distances etc but I suspect the game will work better if you don’t know you are contagious. Or you could keep 1 micro:bit showing the confused face so you know someone is infected.)

After 100 seconds (1 minute and 40 seconds) of being contagious you become sick. Your micro:bit now shows a sad face. Your players won’t necessarily realise this, but when you are sick you are actually no longer contagious. This will actually reward players who stick with the sick, but it would be interesting to see if this actually happens in practice.

After another 100 seconds of being sick, you die – your screen shows a skull and the program stops. You could of course set a time limit on the game, depending on how many players you have and how big an area you have to move around in. Stop the game after 5 minutes and see who is dead, sick or still happy. Or give the micro:bits to random people in different parts of the building and see how long it takes in a normal working or school day for everyone to get sick (though you’d probably need to increase the timings. (Timer == 1000 tests for 100 seconds – I picked short durations to fit a few games of this into a lesson or single 45 minute Code Club).

For extensions you could add a master controller that stops the game and displays everyone’s true status. But I quite like the fact that this code is simple and everyone has the same code on their micro:bits.

You could also have people wearing their micro:bits like badges and see how people react to them depending on their displayed status (this reminds me of both Doctor Who and Black Mirror for some reason!) You might even get a PSHE lesson off the back of this.

You can download the hex file here. Here’s the Python program:

from microbit import *
import radio

#health 3=healthy, 2=incubating/infectious, 1=sick, 0=dead
timer = 0
health = 3
radio.config(power=0) # low power so you must get close
radio.on()

while health != 0:
    display.show(Image.HAPPY)
    if health == 2:
        radio.send('virus')
#        display.show(Image.CONFUSED)
# uncomment line above for debugging - you should not know if you are infectious!
    message = radio.receive()
    if message == 'virus' and health == 3:
        health = 2
    if health == 2:
        timer += 1
    if timer == 1000:
        health = 1
        display.show(Image.SAD)
    if health == 1:
        timer += 1
    if timer == 2000:
        health = 0
    if button_a.was_pressed() and button_b.was_pressed():
        health = 2
    print(timer)
    sleep(100)

display.show(Image.SKULL)
radio.off()

I’ve not tried this out yet – going to give it my KS2 Code Clubbers next term to see what they make of it. If you use this or have ideas for improving it, please let me know,

This entry was posted in computers, microbit and tagged , , , . Bookmark the permalink.

Leave a Reply