Migrate docs from the other repo

This commit is contained in:
Michal Moskal
2016-03-25 16:47:20 -07:00
parent 38d2cf06d2
commit a08eb53f92
895 changed files with 36888 additions and 0 deletions

View File

@ -0,0 +1,87 @@
# bop it challenges
a game similar to "Simon Says" with the BBC micro:bit. #docs
## Before we get started
Complete the following guided tutorial:
* [tutorial](/microbit/lessons/bop-it/tutorial)
At the end of the tutorial, click `keep editing`. Your code should look like this:
```
newAction() // ***
input.onButtonPressed("A", () => {
if (action == 0) {
game.addScore(1) // ***
newAction() // ***
}
}) // ***
input.onLogoDown(() => {
if (action == 1) {
game.addScore(1) // ***
newAction() // ***
}
}) // ***
input.onGesture(Gesture.Shake, () => {
if (action == 2) {
game.addScore(1) // ***
newAction() // ***
}
}) // ***
input.onButtonPressed("B", () => {
basic.showNumber(game.score(), 150) // ***
basic.pause(2000) // ***
newAction() // ***
}) // ***
```
### Challenge 1
Now let's add some more types of instructions for the player to follow. Let's add `PRESS PIN 0`. Change the global variable `action` to `math->random(4)` so that we can add a new **IF** statement that checks if `action=3`. If it does, display instructions to press pin 0.
```
/**
* {highlight}
*/
export function newAction_() {
action = Math.random(4) // ***
if (action == 0) {
basic.showString("PUSH A", 150) // ***
}
if (action == 1) {
basic.showString("LOGO DOWN", 150) // ***
}
if (action == 2) {
basic.showString("SHAKE", 150) // ***
}
if (action == 3) {
basic.showString("PRESS PIN 0", 150) // ***
}
}
```
### Challenge 2
Now let's implement `PRESS PIN 0` in the main. Create a condition of `input->on pin pressed("P0")` that will add one to the score and calls the method `new action`.
```
// **. . .**
input.onButtonPressed("B", () => {
basic.showNumber(game.score(), 150) // ***
basic.pause(2000) // ***
newAction() // ***
}) // ***
input.onPinPressed("P0", () => {
if (action == 3) {
game.addScore(1) // ***
newAction() // ***
}
}) // ***
```
### Challenge 3
Add `POINT ME NORTH` to the list of possible commands.

View File

@ -0,0 +1,86 @@
# bop it quiz answers
a game where you have to keep up with the commands #math #random #docs
## Name
## Directions
Use this activity document to guide your work in the [bop it tutorial](/microbit/lessons/bop-it/tutorial).
Answer the questions while completing the tutorial. Pay attention to the dialogues!
## 1. Write the code that will store the global variable named 'action' and returns a random number between 0 and 2
<br/>
```
action = Math.random(3)
```
## 2. Write the code that will display the string, "PUSH A" if the global variable called 'action' is equal to 0
<br />
```
if (action == 0) {
basic.showString("PUSH A", 150)
}
```
## 3. Write the code that increments the score if button A is pressed when the global variable called 'action' is equal to 1
<br />
```
input.onButtonPressed("A", () => {
if (action == 0) {
game.addScore(1)
}
})
```
## 4. Write the code that will display the string "LOGO DOWN" if the global variable called 'action' is equal to 1
<br />
```
if (action == 1) {
basic.showString("LOGO DOWN", 150)
}
```
## 5. Write the code that increments the score if the BBC micro:bit logo is tilted down when the global variable called 'action' is equal to 1
<br />
```
input.onLogoDown(() => {
if (action == 1) {
game.addScore(1)
}
})
```
## 6. Write the code that will display the string "SHAKE" if the global variable called 'action' is equal to 2
<br />
```
if (action == 2) {
basic.showString("SHAKE", 150)
}
```
## 7. Write the code that increments the score if the BBC micro:bit is shaken when the global variable called 'action' is equal to 2
<br/>
```
input.onLogoDown(() => {
if (action == 1) {
game.addScore(1)
}
})
```

View File

@ -0,0 +1,40 @@
# bop it quiz
a game where you have to keep up with the commands #math #random #docs
## Name
## Directions
Use this activity document to guide your work in the [bop it tutorial](/microbit/lessons/bop-it/tutorial).
Answer the questions while completing the tutorial. Pay attention to the dialogues!
## 1. Write the code that will store the global variable named 'action' and returns a random number between 0 and 2
<br/>
## 2. Write the code that will display the string, "PUSH A" if the global variable called 'action' is equal to 0
<br />
## 3. Write the code that increments the score if button A is pressed when the global variable called 'action' is equal to 1
<br />
## 4. Write the code that will display the string "LOGO DOWN" if the global variable called 'action' is equal to 1
<br />
## 5. Write the code that increments the score if the BBC micro:bit logo is tilted down when the global variable called 'action' is equal to 1
<br />
<br />
## 6. Write the code that will display the string "SHAKE" if the global variable called 'action' is equal to 2
<br />
## 7. Write the code that increments the score if the BBC micro:bit is shaken when the global variable called 'action' is equal to 2