2016-03-26 00:47:20 +01:00
|
|
|
# spinner quiz answers
|
|
|
|
|
2016-11-01 18:42:42 +01:00
|
|
|
a spin the @boardname@ game with the input on shake.
|
2016-03-26 00:47:20 +01:00
|
|
|
|
|
|
|
## Name
|
|
|
|
|
|
|
|
## Directions
|
|
|
|
|
2016-04-16 00:02:26 +02:00
|
|
|
Use this activity document to guide your work in the [spinner activity](/lessons/spinner/activity).
|
2016-03-26 00:47:20 +01:00
|
|
|
|
|
|
|
Answer the questions while completing the tutorial. Pay attention to the dialogues!
|
|
|
|
|
|
|
|
## 1. Write the code that stores a random number between 0 and 3 into a local variable named 'random arrow'.
|
|
|
|
|
|
|
|
<br/>
|
|
|
|
|
2016-03-30 22:41:01 +02:00
|
|
|
```blocks
|
2018-06-01 20:42:38 +02:00
|
|
|
let randomArrow = Math.randomRange(0, 4)
|
2016-03-26 00:47:20 +01:00
|
|
|
```
|
|
|
|
|
|
|
|
## 2. Write the if statement that will display this down arrow from your code. Hint- This occurs if the local variable 'random arrow' returns 1.
|
|
|
|
|
|
|
|
![](/static/mb/lessons/spinner-0.png)
|
|
|
|
|
|
|
|
<br/>
|
|
|
|
|
2016-03-30 22:41:01 +02:00
|
|
|
```blocks
|
2018-06-01 20:42:38 +02:00
|
|
|
let randomArrow = Math.randomRange(0, 4);
|
2016-03-26 00:47:20 +01:00
|
|
|
if (randomArrow == 1) {
|
2016-10-23 06:29:31 +02:00
|
|
|
basic.showLeds(`
|
2016-03-26 00:47:20 +01:00
|
|
|
. . # . .
|
|
|
|
. . # . .
|
|
|
|
# # # # #
|
|
|
|
. # # # .
|
|
|
|
. . # . .
|
|
|
|
`)
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
## 3. Write the if statement that will display this right arrow. Hint- This occurs if the local variable 'random arrow' returns 2.
|
|
|
|
|
|
|
|
![](/static/mb/lessons/spinner-1.png)
|
|
|
|
|
|
|
|
<br />
|
|
|
|
|
2016-03-30 22:41:01 +02:00
|
|
|
```blocks
|
2018-06-01 20:42:38 +02:00
|
|
|
let randomArrow = Math.randomRange(0, 4);
|
2016-03-26 00:47:20 +01:00
|
|
|
if (randomArrow == 2) {
|
2016-10-23 06:29:31 +02:00
|
|
|
basic.showLeds(`
|
2016-03-26 00:47:20 +01:00
|
|
|
. . # . .
|
|
|
|
. . # # .
|
|
|
|
# # # # #
|
|
|
|
. . # # .
|
|
|
|
. . # . .
|
|
|
|
`)
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|