* missing packages

* fixing snippet issues

* snippet fix

* more doc fixes
This commit is contained in:
Peli de Halleux
2017-08-18 08:34:01 -07:00
committed by GitHub
parent 3180229bce
commit 325ccce3a0
8 changed files with 70 additions and 55 deletions

View File

@ -23,145 +23,145 @@ https://youtu.be/VmD-dcZZQFc
```blocks
input.onButtonPressed(Button.B, () => {
if (128 > input.lightLevel() && 0 < input.lightLevel() && input.temperature() > 22) {
basic.showAnimation(`
basic.showLeds(`
. # . # .
# . . . #
. . . . .
. . . . .
. . . . .
`, 500)
basic.showAnimation(`
`)
basic.showLeds(`
. # # # .
# . . . #
. . . . .
. . . . .
. . . . .
`, 500)
basic.showAnimation(`
`)
basic.showLeds(`
. # # # .
# . . . #
. # . # .
. . . . .
. . . . .
`, 500)
basic.showAnimation(`
`)
basic.showLeds(`
. # # # .
# . . . #
. # # # .
. . . . .
. . . . .
`, 500)
basic.showAnimation(`
`)
basic.showLeds(`
. . . . .
. # . # .
. . . . .
. # # # .
# . . . #
`, 500)
`)
} else {
basic.showAnimation(`
basic.showLeds(`
# . . . .
. . . . .
. . . . .
. . . . .
. . . . .
`, 500)
basic.showAnimation(`
`)
basic.showLeds(`
. # . . .
# # . . .
. . . . .
. . . . .
. . . . .
`, 500)
basic.showAnimation(`
`)
basic.showLeds(`
. . # . .
. . # . .
# # # . .
. . . . .
. . . . .
`, 500)
basic.showAnimation(`
`)
basic.showLeds(`
. . # # .
. . # . .
# # # . .
# . . # .
. . . . .
`, 500)
basic.showAnimation(`
`)
basic.showLeds(`
. . # # #
. . # . .
# # # . .
# . . # .
# . . . #
`, 500)
basic.showAnimation(`
`)
basic.showLeds(`
. . . . .
. # . # .
. . . . .
# . . . #
. # # # .
`, 500)
`)
}
})
input.onButtonPressed(Button.A, () => {
if (input.temperature() < 22 && input.temperature() > 6) {
basic.showAnimation(`
basic.showLeds(`
. . . . .
. . . . .
. . # . .
. . . . .
. . . . .
`, 500)
basic.showAnimation(`
`)
basic.showLeds(`
. . . . .
. . # . .
. # # # .
. . # . .
. . . . .
`, 500)
basic.showAnimation(`
`)
basic.showLeds(`
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
`, 500)
basic.showAnimation(`
`)
basic.showLeds(`
# # # # #
# # # # #
# # # # #
# # # # #
# # # # #
`, 500)
`)
} else {
basic.showAnimation(`
basic.showLeds(`
. . . . .
. . . . .
. . # . .
. . . . .
. . . . .
`, 500)
basic.showAnimation(`
`)
basic.showLeds(`
. . . . .
. . . . .
. # # # .
. . . . .
. . . . .
`, 500)
basic.showAnimation(`
`)
basic.showLeds(`
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
`, 500)
basic.showAnimation(`
`)
basic.showLeds(`
# # # # #
# . . . #
# . . . #
# . . . #
# # # # #
`, 500)
`)
}
})
input.onGesture(Gesture.Shake, () => {
@ -303,8 +303,9 @@ This is an example of a board game in which the micro:bit displays an arrow poin
Here is a portion of the board game's code. A boolean variable is used to determine whose turn it is. If player1Turn is false, then it's player 2's turn. A random number is generated to show the arrow seventy-five percent of the time (for values of 0, 1, or 2).
```blocks
let player1Turn = false;
input.onGesture(Gesture.Shake, () => {
if (player1Turn == true && Math.random(4) < 3) {
if (player1Turn == true && Math.random(4) < 3) {
}
})