pxt-calliope/docs/reference/js/lessons/catch-the-egg-game.md

92 lines
4.1 KiB
Markdown
Raw Normal View History

2016-03-26 00:47:20 +01:00
# catch the egg game lesson
a game to catch eggs in a basket #var #data #if #random #min #max #mod #plot #unplot #pause #accceleration #docs
### @video td/videos/catch-the-egg-game-0
## Topic
Variables
## Quick Links
* [tutorial](/microbit/lessons/catch-the-egg-game/tutorial)
* [quiz](/microbit/lessons/catch-the-egg-game/quiz)
* [quiz answers](/microbit/lessons/catch-the-egg-game/quiz-answers)
* [challenges](/microbit/lessons/catch-the-egg-game/challenges)
## Class
Year 7
## Prior learning/place of lesson in scheme of work
Learn how to create a catch the egg game game with **plot**, `led->plot` , **unplot**, `led->unplot`, and **acceleration** `input -> acceleration` to turn on and off LED lights on the LED screen. We will be learning how to create a catch the egg game app using global variables, forever loop, local variable, input acceleration, math min, math max, math random, math mod, if (conditionals), game library as well as simple commands, such as led plot, led unplot, and pause.
## Documentation
* **variables** : [read more...](/microbit/reference/variables/var)
* **forever** : [read more...](/microbit/reference/basic/forever)
* **unplot** : [read more...](/microbit/reference/led/unplot)
* **plot** : [read more...](/microbit/reference/led/plot)
* **if** : [read more...](/microbit/reference/logic/if)
* **acceleration** : [read more...](/microbit/reference/input/acceleration)
* **math minimum number** : [read more...](/microbit/js/math)
* **math maximum number** : [read more...](/microbit/js/math)
* **math random number** : [read more...](/microbit/js/math)
* **math modulus** : [read more...](/microbit/js/math)
* **show number** : [read more...](/microbit/reference/basic/show-number)
* **pause** : [read more...](/microbit/reference/basic/pause)
## Objectives
* learn how to create a global variable as a place where you can store data so that you can use it later in your code, accessible across functions and in nested code blocks
* learn how to repeat code in the background forever
* learn how to turn off a LED light on the LED screen
* learn how to turn on a LED light on the LED screen
* learn how to learn how to conditionally run code depending on whether a condition is true or not
* learn how to learn how to get the acceleration value (g-force), in one of three specified dimensions
* learn how to return the smaller of two numbers
* learn how to return the larger of two numbers
* learn how to return a random number
* learn how to return the modulus
* learn how to show a number of the BBC micro:bit screen
* learn how to pause your code for the specified number of milliseconds
## Progression Pathways / Computational Thinking Framework
#### Algorithms
* Designs solutions (algorithms) that use repetition and two-way selection, ie if, then and else.(AL)
* Uses logical reasoning to predict outputs, showing an awareness of inputs (AL)
* Recognises that different solutions exist for the same problem (AL) (AB) Understands that iteration is the repetition of a process such as a loop (AL)
* 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)
* Understands the difference between, and appropriately uses if and if, then and else statements(AL)
* Uses a variable and relational operators within a loop to govern termination (AL) (GE)
* Has practical experience of a high-level textual language, including using standard libraries when programming(AB) (AL)
* Uses a range of operators and expressions e.g. Boolean, and applies them in the context of program control. (AL)
* Selects the appropriate data types(AL) (AB
Computational Thinking Concept: AB = Abstraction; DE = Decomposition; AL = Algorithmic Thinking; EV = Evaluation; GE = Generalisation
## Activity
* time: 20 min.
* [tutorial](/microbit/lessons/catch-the-egg-game/tutorial)
* [quiz](/microbit/lessons/catch-the-egg-game/quiz)
## Extended Activity
* time: 20 min.
* [challenges](/microbit/lessons/catch-the-egg-game/challenges)
## Homework
* Extended Activity: [challenges](/microbit/lessons/catch-the-egg-game/challenges)