Bonus
The micro:bit uses its accelerometer to detect when you’re shaking it. How does an accelerometer actually work?
Many board games use an electronic toy to signal moves, or provide clues. There are some funny examples online if you search for “electronic board game”. Here are some examples:
Dark Tower (featuring Orson Welles): This is an example of a circular board game in which the pieces start on the edges and move in toward the middle.
Stop Thief Electronic Board Game commercial 1979: This board game uses a device to give audio clues that help you to figure out what to do on the game board. It’s a good example of how you might use sound as a clue.
Create an original board game project in which micro:bit is a central feature. The rules of your board game should use Conditionals.
Come up with:
The micro:bit needs to work in conjunction with the game board and/or game pieces and should be a central feature of the game. Ideally, it should be more than a simple substitute for a six-sided die.
The micro:bit might:
Try to code your micro:bit to do something original. Here is one example:
In this example, pieces start out at full strength and lose points based on random events on the board.
Rules: When two pieces meet on the same space, they battle.
let p2 = 0
let p1 = 0
input.onButtonPressed(Button.A, () => {
p1 += 1
basic.showNumber(p1)
})
input.onButtonPressed(Button.B, () => {
p2 += 1
basic.showNumber(p2)
})
input.onGesture(Gesture.Shake, () => {
if (randint(0, p1 + p2) <= p1) {
basic.showString("A")
} else {
basic.showString("B")
}
})
Solution link: Battle Pieces Project
How to win: Starting from Earth, your goal is to progress to Mars. The first person to reach Mars is the winner.
Rules:
Finished game
micro:bit holder
Game pieces
let yes_or_no = 0
let current_roll = 0
let previous_roll = 0
input.onButtonPressed(Button.AB, () => {
previous_roll = 0
if (4 <= previous_roll) {
yes_or_no = randint(0, 8)
}
if (4 > previous_roll) {
yes_or_no = randint(0, 5)
}
if (2 < yes_or_no) {
basic.showString("YES")
basic.clearScreen()
} else {
basic.showString("NO")
basic.clearScreen()
}
})
input.onGesture(Gesture.Shake, () => {
current_roll = randint(0, 6)
basic.showNumber(current_roll + 1)
basic.pause(5000)
basic.clearScreen()
})
input.onButtonPressed(Button.B, () => {
previous_roll += 1
basic.showNumber(previous_roll)
})
input.onButtonPressed(Button.A, () => {
previous_roll += -1
basic.showNumber(previous_roll)
})
basic.showString("SPACE RACE")
previous_roll = 0
Solution link: Space Race Project
Write a short reflection in your journal (about 150–300 words), addressing the following points: