Dice are a staple in most math classrooms, as they are a simple yet effective way to engage students in the exploration of different math concepts. In particular, math games that use dice help students to develop a positive relationship with math and actively investigate probability.
Now, what if we could integrate the development of computational thinking skills within this commonly used strategy by incorporating the micro:bit?
When exploring the “Math” category of MakeCode for micro:bit, you may have noticed that there is a “pick random” block. It picks a random number between the minimum and maximum number selected. This block can become a great tool for randomized investigations in the classroom, and one of the easiest starting points is to code micro:bit dice.
There are many different ways to create micro:bit dice, so the code below is just a starting point. I selected to have my code run “on shake,” as students seem to enjoy this input option. The key is that students must use logic (e.g. conditionals) so that when a certain random number is selected, the appropriate LEDs light up on the micro:bit display. Note that in the program below, the random number is never displayed, only the appropriate LEDs are illuminated.
How would you complete this code so that the appropriate LEDs light up depending on your “roll”?
Once students have created their code and flashed it to a micro:bit, they will be able to use their micro:bit dice to engage in any activity that requires conventional dice, such as math games.
For ideas on how to use dice games in the K-6 classroom, try this website. They provide some high-quality ideas and include downloadable instruction sheets for each math dice game. My personal favourite is Shut the Box, but I’m curious to try some of the other options!
If you’d like to remix or tinker with this sample program in the MakeCode editor, check out this link: https://makecode.microbit.org/_XwXHh42wXWpr