pxt-calliope/docs/lessons/rock-paper-scissors.md
2016-05-26 15:24:10 -07:00

65 lines
1.7 KiB
Markdown

# rock paper scissors lesson
a game against the BBC micro:bit.
## Topic
Local Variables
## Quick Links
* [activity](/lessons/rock-paper-scissors/activity)
* [challenges](/lessons/rock-paper-scissors/challenges)
## Class
Year 7
## Prior learning/place of lesson in scheme of work
Learn how to create a **local variable**, `var t :=time` where you can store data, so that you can use it in your code. We will be learning how to create a classic rock paper scissors game using global variables, input on shake, local variables, math random as well as simple commands such as create image, show image, show string, and show number.
## Documentation
```cards
input.onGesture(Gesture.Shake, () => {})
Math.random(3)
let x = 0
basic.showLeds(`
. . . . .
. . . . .
. . # . .
. . . . .
. . . . .
`)
```
## Objectives
* learn how to create a condition so the micro:bit will run code when it is shaken
* learn how to create a local variable for a place where you can store data
* learn how to create an image to show on the micro:bit's LED screen
* learn how to show an image on the micro:bit's LED screen
## Progression Pathways / Computational Thinking Framework
#### Algorithms
* Uses diagrams to express solutions.(AB)
* Represents solutions using a structured notation (AL) (AB)
#### Programming & Development
* Creates programs that implement algorithms to achieve given goals (AL)
* Declares and assigns variables(AB)
* Selects the appropriate data types(AL) (AB
#### Data & Data Representation
* Defines data types: real numbers and Boolean (AB)
Computational Thinking Concept: AB = Abstraction; DE = Decomposition; AL = Algorithmic Thinking; EV = Evaluation; GE = Generalisation