Introduction: Zap the Rat - BBC Micro:bit Game

About: Retired teacher of computing - started 1967 with FORTRAN IV. I now play with development boards such as Raspberry Pi, Pico, Arduino, micro:bit and Adafruit CircuitPython boards like the Insybitsy M4 and Circui…

The BBC micro:bit has square grid of 25 LEDS and two buttons. Can we make an addictive, competitive game with scoring and a prize display with so few resources? Here is my attempt.

Step 1: How It Plays

A rat, represented by a moving LED runs anti-clockwise round the edge of the display. The player presses button B, to Zap the Rat, while the rat is LIT and in the ZAP position (red), between the marker (orange) and button B. This is harder than it appears. If the rat is ZAPPED one of the score LEDs is switched on (light blue). The player has to zap three rats to complete the turn. If the player misses a rat an opportunity missed is counted against him - up to a maximum of 25.
Once three rats have been zapped the score of missed rats is displayed on the LEDs. A perfect score is ZERO missed rats - harder to achieve than you think - and a display appears on the grid of LEDs.

Step 2: What You Need

What you will need:

  • BBC micro:bit
  • USB cable
  • Mu Editor

May I suggest that you use the Mu editor to enter the script and then
modify it. You can find the editor at . I use this editor as it supports REPL (read–eval–print loop) and print statements, makes transferring your program to a micro:bit much simpler and it is easy to switch between modes (for micro:bit, Python 3, Adafruit CircuitPython and Pygame Zero).

To flash your script to the micro:bit you just click on the ‘Flash’ icon at the top of the editor window – no more drag and drop with ‘hex’ files!

The instructions about how to install it and use it to program the micro:bit are on the site.

The code for the game is here:

Have fun

Games Contest

Participated in the
Games Contest