20 February 2023
Celebrate Pancake Day with the micro:bit
Pancake Day, or Shrove Tuesday to give its official name. Get me thinking about two things:- Plastic Jif Lemons and one of the first applications I ever saw of the micro:bit, the Pancake Game. I was fortunate to be at the very inception of the BBC micro:bit, The first application I saw of physical computing was demonstrated by Howard Baker and David Whale (@whaleygeek) and it was the micro:bit pancake game. That was over 8 years ago. So I thought I would resurrect it and share here.
The original game was written in javascript in the Touchdevelop editor and is a great illustration of how the project has developed.
It's also really useful as an example of a program written in a text based language. Pupils could use PRIMM to identify how the program works
micro:bit Pancake game
You will need the original hex file - available here
This is the main part of the program. To see the rest of the code. Make sure you have selected Javascript in the coding language selector at the top of the page.
Next under the micro:bit simulator. Open up the explorer and click on the file called custom.ts
Explanation of the game
The purpose of this game is to flip the virtual egg 5 times to fry a pancake. But to make this a
perfect pancake, the virtual egg must be fried for just the right amount of time. Flip too soon and you won't get a point, as the egg won't be cooked properly. Flip too late and your egg catches fire and you lose the point!
Press the B button to start the game, and you will see a pancake float down from the sky and land ready for cooking. It's corners will flip up and down to show you that it is cooking, and at a random time (which makes the game different every time and more interesting!) the egg will be perfectly cooked. It will curl it's corners up and look a bit happy, and this is the right time to flip the egg!
Flip the frying pan up and down, and your virtual egg on the screen should flip up into the sky, turn over, and land again. But be careful to not tilt your frying pan too much, otherwise you will drop the egg on the floor! (If you see an X come on the screen, it means you dropped your egg and the game is over!)
If you leave your egg cooking for too long it will burn, and you will see an animation on the screen of smoke rising from it – but quick, you can recover this egg, you can turn the smoke alarm off by reaching for the sky with your frying pan! If you do this quickly enough, the egg is recovered but you don't get the point. Try again to get some more points without dropping your egg.
At the end of the game, your score flashes on the screen. The highest score possible is 5 points.
Press the B button to finish the game, and the pancake will float up into the sky and the game is finished.
Try attaching the micro:bit to a small frying pan for some extra realism. Perhaps organise a flip-off or pancake race.
A real challenge for your students
Could your students re-develop this game using the makecode or python editors, bringing this great game up to date?
Download the original resource here - Thanks David Whale
We will happily share their solutions here on the CAS website.