added shuffled lessons

This commit is contained in:
Peli de Halleux 2016-05-06 11:31:25 -07:00
parent 4d056e0c23
commit ce16e64660
2 changed files with 64 additions and 0 deletions

View File

@ -11,6 +11,7 @@ If (Conditionals)
## Quick Links ## Quick Links
* [activity](/lessons/truth-or-dare/activity) * [activity](/lessons/truth-or-dare/activity)
* [tutorial](/lessons/truth-or-dare/tutorial)
* [challenges](/lessons/truth-or-dare/challenges) * [challenges](/lessons/truth-or-dare/challenges)
* [quiz](/lessons/truth-or-dare/quiz) * [quiz](/lessons/truth-or-dare/quiz)
* [quiz answers](/lessons/truth-or-dare/quiz-answers) * [quiz answers](/lessons/truth-or-dare/quiz-answers)

View File

@ -0,0 +1,63 @@
# truth or dare tutorial
### ~avatar avatar
### @video td/videos/truth-or-dare-0
The *Truth or dare!* game works as follows: a player spins the BBC micro:bit on the table.
When the micro:bit stops spinning, the player pointed by the arrow (displayed on screen) must press the button "A"
to see if she has to provide a *truth* or a *dare*.
### ~
### Rebuild the game!
The blocks have been shuffled! Put them back together so that...
* an up arrow is displayed when the micro:bit is powered on.
* on button `A` is pressed,
* randomly display "TRUTH" or "DARE" on the screen
* show the up arrow again.
```shuffle
basic.showLeds(`
. . # . .
. # # # .
# # # # #
. . # . .
. . # . .
`)
input.onButtonPressed(Button.A, () => {
let random = Math.random(2)
if (random == 0) {
basic.showString("TRUTH")
} else {
basic.showString("DARE")
}
basic.showLeds(`
. . # . .
. # # # .
# # # # #
. . # . .
. . # . .
`)
})
```
### Hints and tips
Cut out these documentation cards to help you!
```cards
basic.showLeds(`
. . # . .
. # # # .
# . # . #
. . # . .
. . # . .
`);
Math.random(2);
basic.showString("TRUTH");
if (true) {} else {}
"TRUTH";
0;
input.onButtonPressed(Button.A, () => {});
```