pxt-calliope/docs/lessons/rock-paper-scissors.md

65 lines
1.7 KiB
Markdown
Raw Normal View History

2016-03-26 00:47:20 +01:00
# rock paper scissors lesson
2016-04-02 01:22:47 +02:00
a game against the BBC micro:bit.
2016-03-26 00:47:20 +01:00
2016-05-27 00:24:10 +02:00
2016-03-26 00:47:20 +01:00
## Topic
Local Variables
## Quick Links
2016-04-13 17:27:45 +02:00
* [activity](/lessons/rock-paper-scissors/activity)
* [challenges](/lessons/rock-paper-scissors/challenges)
2016-03-26 00:47:20 +01:00
## 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
2016-04-05 07:33:13 +02:00
```cards
input.onGesture(Gesture.Shake, () => {})
2016-03-30 01:17:34 +02:00
Math.random(3)
let x = 0
basic.showLeds(`
. . . . .
. . . . .
. . # . .
. . . . .
. . . . .
`)
```
2016-03-26 00:47:20 +01:00
## 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