moving out outdated js docs

This commit is contained in:
Peli de Halleux
2016-04-15 14:37:25 -07:00
parent 6515cc0360
commit bb6ae00a49
153 changed files with 0 additions and 81 deletions

View File

@ -0,0 +1,87 @@
# flipping bird challenges
Coding challenges for flipping bird. #docs
## Before we get started
Complete the following guided tutorial:
* [tutorial](/lessons/flipping-bird/tutorial)
At the end of the tutorial, click `keep editing`. Your code should look like this:
```
counter = 0
input.onGesture(Gesture.Shake, () => {
counter = counter + 1
if (math.mod(counter, 2) == 1) {
basic.plotImage(`
# # . # #
. . # . .
. . . . .
. . . . .
. . . . .
`)
}
})
```
### Challenge 1
We handled the case of when `math->mod(counter,2) = 1`. We haven't done anything when the remainder is 0! Add an if statement to handle this case.
```
counter = 0
input.onGesture(Gesture.Shake, () => {
counter = counter + 1
if (math.mod(counter, 2) == 1) {
basic.plotImage(`
# # . # #
. . # . .
. . . . .
. . . . .
. . . . .
`)
}
if (math.mod(counter, 2) == 0) {
}
})
```
### Challenge 2
### @video td/videos/flipping-bird-2
Inside of that `if` statement you created in challenge 1, add `basic->plot image()` and display an upside down flying bird.
```
counter = 0
input.onGesture(Gesture.Shake, () => {
counter = counter + 1
if (math.mod(counter, 2) == 1) {
basic.plotImage(`
# # . # #
. . # . .
. . . . .
. . . . .
. . . . .
`)
}
if (math.mod(counter, 2) == 0) {
basic.plotImage(`
. . . . .
. . . . .
. . . . .
. . # . .
# # . # #
`) // ***
}
})
```
* `Run` the code to see if it works as expected.
**Challenge 3**
Display a check mark and question mark instead of flipping birds. Or better yet, come up with your own pair of opposites to display!

View File

@ -0,0 +1,50 @@
# flipping bird quiz answers
use modulo with a conditional.
This is the answer key for the [flipping bird quiz](/lessons/flipping-bird/quiz).
## 1. What does "modulo" mean in math?
<br/>
Modulo (or Mod) is the remainder of a division problem.
## 2. Consider the following code
If the rectangle below represents the BBC micro:bit, shade in the LEDs that show the value being stored into the **global variable**, `count`. Explain why that particular area is shaded.
```
count = 1
count_ = count_ + 2
```
<br/>
<br/>
![](/static/mb/lessons/flipping-bird-0.png)
The variable `count` is now equal to 3.
<br/>
## 3. Consider the following directions
Modulo (Mod) tells us what the remainder of a division is. For example, `15 mod 4 is 3` since 15 divided by 4 has a remainder of 3.
```
count = 12
count = math.mod(count, 5)
```
If the rectangle below represents the BBC micro:bit, shade in the LEDs that show the value being stored into the **global variable**, `count`. Explain why that particular area is shaded.
<br/>
<br/>
![](/static/mb/lessons/flipping-bird-1.png)
The display will show `2` because the remainder of 12 divided by 5 is 2.

View File

@ -0,0 +1,60 @@
# flipping bird quiz
use modulo with a conditional.
## Name
## Directions
Use this activity document to guide your work in the [flipping bird tutorial](/lessons/flipping-bird/tutorial).
Answer the questions while completing the tutorial. Pay attention to the dialogues!
## 1. What does "modulo" mean in math?
## 2. Consider the following directions
If the rectangle below represents the BBC micro:bit, shade in the LEDs that show the value being stored into the **global variable**, `count`.
```
count = 1
```
![](/static/mb/empty-microbit.png)
<br/>
<br/>
## 3. Consider the following code
If the rectangle below represents the BBC micro:bit, shade in the LEDs that show the value being stored into the **global variable**, `count`. Explain why that particular area is shaded.
```
count = 1
count_ = count_ + 2
```
![](/static/mb/empty-microbit.png)
<br/>
<br/>
## 4. Consider the following directions
Modulo (Mod) tells us what the remainder of a division is. For example, `15 mod 4 is 3` since 15 divided by 4 has a remainder of 3.
```
count = 12
count = math.mod(count, 5)
```
If the rectangle below represents the BBC micro:bit, shade in the LEDs that show the value being stored into the **global variable**, `count`. Explain why that particular area is shaded.
![](/static/mb/empty-microbit.png)
<br/>
<br/>