pxt-calliope/olddocs/js/lessons/line-of-fire.md
2016-05-26 19:33:26 -07:00

95 lines
3.9 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# line of fire lesson
Create a game that relies on precise instincts and timing reflexes #if #.
## Topic
Functions
## Quick Links
* [tutorial](/lessons/line-of-fire/tutorial)
* [quiz](/lessons/line-of-fire/quiz)
* [quiz answers](/lessons/line-of-fire/quiz-answers)
## Class
Year 7
## Prior learning/place of lesson in scheme of work
Learn how to create **functions**, `function()` that perform a specific task and returns a result. We will be learning how to create a pong game using functions, global variable forever loop, global variables, Boolean, for loop, input on button pressed, if statements, as well as simple commands, such as plot, unplot and pause.
## Documentation
* **function** : [read more...](/js/function)
* **return** : [read more...](/js/return)
* **call** : [read more...](/js/call)
* **global variable** : [read more...](/js/data)
* **arithmetic operator** : [read more...](/reference/types/number)
* **Boolean** : [read more...](/reference/types/boolean)
* **forever** : [read more...](/reference/basic/forever)
* **on button pressed** : [read more...](/reference/input/on-button-pressed)
* **if** : [read more...](/reference/logic/if)
* **clear screen** : [read more...](/reference/basic/clear-screen)
* **show string** : [read more...](/reference/basic/show-string)
* **plot** : [read more...](/reference/led/plot)
* **unplot** : [read more...](/reference/led/unplot)
* **pause** : [read more...](/reference/basic/pause)
## Objectives
* learn how to create a function as a unit of code that performs a specific task and returns a result
* learn how a return statement exits a function and returns a value to the code
* learn how to call an existing function in your script
* 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 arithmetic operators operate on numbers and return a number
* learn how a Boolean type has one of two possible values: true or false
* learn how to repeat code in the background forever
* learn how to conditionally run code depending on whether a condition is true or not
* learn how to run code when an input button is pressed
* learn how to show a string on the micro:bit's LED screen
* learn how to turn on a LED light on the LED screen. Learn how to specify which LED using x, y coordinates
* learn how to turn off a LED light on the LED screen. Learn how to specify which LED using x, y coordinates
* 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 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
* Defines data types: real numbers and Boolean (AB)
Computational Thinking Concept: AB = Abstraction; DE = Decomposition; AL = Algorithmic Thinking; EV = Evaluation; GE = Generalisation
## Activity
* time: 20 min.
* [tutorial](/lessons/line-of-fire/tutorial)
## Extended Activity
* time: 20 min.
* [quiz](/lessons/line-of-fire/quiz)
## Homework
* Extended Activity: [quiz](/lessons/line-of-fire/quiz)