pxt-calliope/docs/lessons/rock-paper-scissors.md
2016-06-01 21:19:16 -07:00

63 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