From ce16e6466059c518ca5f4030b291def4694a39e3 Mon Sep 17 00:00:00 2001 From: Peli de Halleux Date: Fri, 6 May 2016 11:31:25 -0700 Subject: [PATCH] added shuffled lessons --- docs/lessons/truth-or-dare.md | 1 + docs/lessons/truth-or-dare/tutorial.md | 63 ++++++++++++++++++++++++++ 2 files changed, 64 insertions(+) create mode 100644 docs/lessons/truth-or-dare/tutorial.md diff --git a/docs/lessons/truth-or-dare.md b/docs/lessons/truth-or-dare.md index 7dc14512..88f728ea 100644 --- a/docs/lessons/truth-or-dare.md +++ b/docs/lessons/truth-or-dare.md @@ -11,6 +11,7 @@ If (Conditionals) ## Quick Links * [activity](/lessons/truth-or-dare/activity) +* [tutorial](/lessons/truth-or-dare/tutorial) * [challenges](/lessons/truth-or-dare/challenges) * [quiz](/lessons/truth-or-dare/quiz) * [quiz answers](/lessons/truth-or-dare/quiz-answers) diff --git a/docs/lessons/truth-or-dare/tutorial.md b/docs/lessons/truth-or-dare/tutorial.md new file mode 100644 index 00000000..ad2d993f --- /dev/null +++ b/docs/lessons/truth-or-dare/tutorial.md @@ -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, () => {}); +``` +