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

72 lines
2.9 KiB
Markdown
Raw Normal View History

2016-03-26 00:47:20 +01:00
# the hat game lesson
2016-04-02 01:22:47 +02:00
make a game to test your focus on the moving ball.
2016-03-26 00:47:20 +01:00
## Topic
Functions
## Quick Links
2016-04-13 17:27:45 +02:00
* [tutorial](/lessons/the-hat-game/tutorial)
* [quiz](/lessons/the-hat-game/quiz)
* [quiz answers](/lessons/the-hat-game/quiz-answers)
* [challenges](/lessons/the-hat-game/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 **functions**, `function()` as a unit of code that performs a specific task and returns a result. We will be learning how to create the hat game app using functions, global variables, input on button pressed, if (conditionals), mod, random, Boolean, as well as simple commands such as show animation.
## Documentation
2016-04-13 17:27:45 +02:00
* **functions** : [read more...](/js/function)
* **on button pressed** : [read more...](/reference/input/on-button-pressed)
* **for** : [read more...](/reference/loops/for)
* **if** : [read more...](/reference/logic/if)
* **mod** : [read more...](/js/math)
* **show animation** : [read more...](/reference/basic/show-animation)
2016-03-26 00:47:20 +01:00
## 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 learn how to conditionally run code depending on whether a condition is true or false
* learn how to return the modulus
* learn how to show a series of image frames on the LED screen
* learn how to run code when an input button is pressed
## Progression Pathways / Computational Thinking Framework
#### Algorithms
* Designs solutions (algorithms) that use repetition and two-way selection, ie if, then and else.(AL)
* Uses diagrams to express solutions.(AB)
* Uses logical reasoning to predict outputs, showing an awareness of inputs (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)
* Uses post-tested loop e.g.until,and a sequence of selection statements in programs,including an if,then and else statement(AL)
* 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)
* 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
#### Data & Data Representation
* Understands the difference between data and information(AB)
* Performs more complex searches for information e.g. using Boolean and relational operators(AL) (GE) (EV)
* Defines data types: real numbers and Boolean (AB)
#### Hardware & Processing
* Knows that computers collect data from various input devices, including sensors and application software (AB)
Computational Thinking Concept: AB = Abstraction; DE = Decomposition; AL = Algorithmic Thinking; EV = Evaluation; GE = Generalisation