All Resources

A Micro:bit Too Greedy

In this activity, learners will learn about the basic concepts of coding and explore some of the ways that coding and technology can be used in our everyday lives.

Specifically, learners will learn about the following coding terminology: algorithms, variables, inputs, and outputs. They will familiarize themselves with Microsoft MakeCode and learn to program their micro:bits to play the probability game, “A Micro:bit Too Greedy” (commonly referred to as “Greedy Pig”). 

If you do not have micro:bits and are local, sign up for access for access to our loaner kits!

Definitions:

  • Algorithm: a set of instructions that are followed to solve a problem
  • Input: an action the user gives to the computer (eg. pressing the "on" button on your TV remote)
  • Output: an action the computer gives to the user (eg. your TV turning on)
  • Variable: a value that can change, depending on conditions or information passed to the program

Objectives

  • Navigate and use Microsoft MakeCode

  • Create an algorithm that successfully generates randomized numbers on a micro:bit

  • Explore the risks and rewards associated with probability

Materials

  • Micro:bit with battery pack

  • Laptop with microUSB cord
    OR
    Tablet with Micro:bit app installed

  • (Optional) Whiteboard / paper and writing utensil [to keep track of scores]

Key Questions

  • What was the hardest part about using MakeCode to program code onto your micro:bit?
  • What are the potential benefits of using a micro:bit to generate random numbers as opposed to a traditional die?
  • What are the potential drawbacks of using a micro:bit to generate random numbers as opposed to a traditional die?
  • Are there other games that you can think of that micro:bits could be used for?
  • What strategies did you use to try and get the highest score in the game, "A Micro:bit Too Greedy"?

What To Do

If this is your first time using a micro:bit, we recommend you follow familiarize yourself with the First Steps as outlined on the micro:bit website here

Note: If coding on computers or laptops, we highly recommend using Micro:bit classroom which allows you to lock student’s screens, send them code, and edit their code. More information on using micro:bit classroom here

Coding Introduction

  1. Ask the learners, “What is coding? Why do we code?” (Give learners an opportunity to activate their prior knowledge and share their experiences with coding)
  2. Once they have shared their ideas, offer a simple definition of coding. Eg: “Coding is a language that we [humans] use with computers to get them to do what we ask them to.
  3. Introducing the challenge: “Today we are going to try and code our micro:bits to behave like a 6-sided die. But first, we need to think about:”
    • What is a 6-sided die?
    • How do we use dice?
    • What actions are required to use a die?
    • Why do we use dice?
    • Encourage learners to be as specific as possible when describing the steps involved in rolling a die!
  4. Explain that when we use dice, we roll the die (input), the die rolls around randomly until it stops (algorithm), revealing a random number (output).
    • You can model these steps by drawing this diagram on the board:
  5. Remind learners that their challenge is to code their micro:bit to behave like a 6-sided die
  6. Give learners time to explore the MakeCode website (or micro:bit app), familiarize themselves with the interface, and attempt the challenge
    • There are multiple ways to complete the challenge
    • The simplest form uses 3 blocks of code from the input, basic, and math categories
    • A more advanced form of the code (that can be adapted to more easily to the extensions) uses 5 blocks of code from the input, basic, math, and variable categories

 

Using the micro:bit to play “A Micro:bit Too Greedy”:

  1. Now that the micro:bit is programmed to randomly generate numbers between 1 and 6, you are ready to play!
  2. The rules of the game are simple:
    • The game consists of “rounds” where each player will simultaneously shake their micro:bit and generate a random number.
    • The number shown on YOUR micro:bit is YOUR score.
    • Add up the numbers from each round to determine your total score.
      BUT!
    • If you roll a 1 at any point in the game, you “bust” and finish the game with a total score of zero points.
    • At the beginning of each round (before shaking the micro:bits), players may choose to “fold.” By folding, a player will keep their current score, but may not shake their micro:bit anymore, thus ending their ability to gain more points.
    • The game ends when either all of the players have “busted” or all of the players have “folded.”

 

Extensions

  • You can use the micro:bits that you have coded to play any game involving dice
  • Try to get the micro:bit to display dice dots instead of numbers
  • Try to figure out how to change the probability of certain numbers appearing and then discuss how that changes the game strategy
  • Have the micro:bit keep track of your score for you

Other Resources

A Microbit Too Greedy Sample Solutions

About the sticker

Survivors

Artist: Jeff Kulak

Jeff is a senior graphic designer at Science World. His illustration work has been published in the Walrus, The National Post, Reader’s Digest and Chickadee Magazine. He loves to make music, ride bikes, and spend time in the forest.

About the sticker

Egg BB

Artist: Jeff Kulak

Jeff is a senior graphic designer at Science World. His illustration work has been published in the Walrus, The National Post, Reader’s Digest and Chickadee Magazine. He loves to make music, ride bikes, and spend time in the forest.

About the sticker

Comet Crisp

Artist: Jeff Kulak

Jeff is a senior graphic designer at Science World. His illustration work has been published in the Walrus, The National Post, Reader’s Digest and Chickadee Magazine. He loves to make music, ride bikes, and spend time in the forest.

About the sticker

T-Rex and Baby

Artist: Michelle Yong

Michelle is a designer with a focus on creating joyful digital experiences! She enjoys exploring the potential forms that an idea can express itself in and helping then take shape.

About the sticker

Buddy the T-Rex

Artist: Michelle Yong

Michelle is a designer with a focus on creating joyful digital experiences! She enjoys exploring the potential forms that an idea can express itself in and helping then take shape.

About the sticker

Geodessy

Artist: Michelle Yong

Michelle is a designer with a focus on creating joyful digital experiences! She enjoys exploring the potential forms that an idea can express itself in and helping then take shape.

About the sticker

Science Buddies

Artist: Ty Dale

From Canada, Ty was born in Vancouver, British Columbia in 1993. From his chaotic workspace he draws in several different illustrative styles with thick outlines, bold colours and quirky-child like drawings. Ty distils the world around him into its basic geometry, prompting us to look at the mundane in a different way.

About the sticker

Western Dinosaur

Artist: Ty Dale

From Canada, Ty was born in Vancouver, British Columbia in 1993. From his chaotic workspace he draws in several different illustrative styles with thick outlines, bold colours and quirky-child like drawings. Ty distils the world around him into its basic geometry, prompting us to look at the mundane in a different way.

About the sticker

Time-Travel T-Rex

Artist: Ty Dale

From Canada, Ty was born in Vancouver, British Columbia in 1993. From his chaotic workspace he draws in several different illustrative styles with thick outlines, bold colours and quirky-child like drawings. Ty distils the world around him into its basic geometry, prompting us to look at the mundane in a different way.