pxt-calliope/docs/lessons/magic-8.md

42 lines
1.3 KiB
Markdown
Raw Normal View History

2016-03-26 00:47:20 +01:00
# magic 8 lesson
a fortune teller game with the @boardname@.
2016-03-26 00:47:20 +01:00
## Topic
If (Conditionals)
## Quick Links
2016-04-13 17:27:45 +02:00
* [activity](/lessons/magic-8/activity)
2016-05-09 18:45:57 +02:00
* [tutorial](/lessons/magic-8/tutorial)
2016-04-13 17:27:45 +02:00
* [challenges](/lessons/magic-8/challenges)
* [quiz](/lessons/magic-8/quiz)
* [quiz answers](/lessons/magic-8/quiz-answers)
2016-03-26 00:47:20 +01:00
## Prior learning/place of lesson in scheme of work
Learn how to creating **conditionals**, `if condition do` to conditionally run code depending on whether a condition is true or not. We will be learning how to create a fortune telling app using local variable and conditionals (If), input on shake as well as simple commands, such as show string, show number, and clear screen.
## Documentation
2016-04-05 07:33:13 +02:00
```cards
if (true) {}
2016-03-30 01:17:34 +02:00
Math.random(3)
2016-04-05 07:33:13 +02:00
input.onGesture(Gesture.Shake, () => {})
2016-03-30 01:17:34 +02:00
basic.showNumber(7)
basic.clearScreen()
basic.showString("Hello!")
2016-03-30 00:59:00 +02:00
```
2016-03-26 00:47:20 +01:00
## Objectives
* learn how to show a string on the LED screen
* learn how to show a number on the LED screen
* learn how to learn how to turn off all the LED lights on the LED screen
* learn how to use the input on shake
* learn how to learn how to create a local variable to store data so that you can use it later in your code
* learn how to learn how to return a random number
* learn how to learn how to conditionally run code depending on whether a condition is true or not