pxt-calliope/docs/reference/js/lessons/minesweeper.md

113 lines
5.6 KiB
Markdown
Raw Normal View History

2016-03-26 00:47:20 +01:00
# minesweeper lesson
2016-04-02 01:22:47 +02:00
A game that tests your memory for placing a LED mine then finding the hidden LED mine.
2016-03-26 00:47:20 +01:00
### @video td/videos/minesweeper-0
## Topic
Global Variables
## Quick Links
2016-04-13 17:27:45 +02:00
* [tutorial](/lessons/minesweeper/tutorial)
* [quiz](/lessons/minesweeper/quiz)
* [quiz answers](/lessons/minesweeper/quiz-answers)
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 minesweeper game with **plot**, `led->plot` , **unplot**, `led->unplot`, **global variables** to keep track of the coordinates that the player is selecting. We will be learning how to create a minesweeper game using global variables, if (conditionals), input on button pressed, math random as well as simple commands such as led plot, led unplot, show string, and pause.
## What the teacher needs to know
* Algorithm: An unambiguous set of rules or a precise step-bystep guide to solve a problem or achieve a particular objective.
* Command: An instruction for the computer to execute, written in a particular programming language.
* Data: A structured set of numbers, possibly representing digitised text, images, sound or video, which can be processed or transmitted by a computer, also used for numerical (quantitative) information.
* Decomposing: The process through which problems or systems are broken down into their component parts, each of which may then be considered separately.
* Input: Data provided to a computer system, such as via a keyboard, mouse, microphone, camera or physical sensors.
* Output: The information produced by a computer system for its user, typically on a screen, through speakers or on a printer, but possibly through the control of motors in physical systems.
* Programmable toys: Robots designed for children to use, accepting input, storing short sequences of simple instructions and moving according to this stored program.
* Program: A stored set of instructions encoded in a language understood by the computer that does some form of computation, processing input and/or stored data to generate output.
* Selection: A programming construct in which one section of code or another is executed depending on whether a particular condition is met.
* Sequence: To place program instructions in order, with each executed one after the other.
* Simulation: Using a computer to model the state and behaviour of real-world (or imaginary) systems, including physical or social systems; an integral part of most computer games.
* Variables: A way in which computer programs can store, retrieve or change data, such as a score, the time left, or the users name.
**QuickStart Computing Glossary
## Documentation
2016-04-13 17:27:45 +02:00
* **global variables** : [read more...](/js/data)
* **math random number** : [read more...](/js/math)
* **plot** : [read more...](/reference/led/plot)
* **unplot** : [read more...](/reference/led/unplot)
* **on button pressed** : [read more...](/reference/input/on-button-pressed)
* **if** : [read more...](/reference/logic/if)
* **show string** : [read more...](/reference/basic/show-string)
* **pause** : [read more...](/reference/basic/pause)
2016-03-26 00:47:20 +01:00
## Resources
2016-04-13 17:27:45 +02:00
* Activity: [tutorial](/lessons/minesweeper/tutorial)
* Activity: [quiz](/lessons/minesweeper/quiz)
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 return a random number
* learn how to turn on a LED light on the LED screen
* learn how to turn off a LED light on the LED screen
* learn how to run code when an input button is pressed
* learn how to conditionally run code depending on whether a condition is true or not
* learn how to show a string of the LED screen one character at a time (scrolling left to right)
* learn how to pause your code for the specified number of milliseconds
## Links to the National Curriculum Programmes of Study for Computing
## 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)
* 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 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)
#### Hardware & Processing
* Knows that computers collect data from various input devices, including sensors and application software (AB)
#### Communication Networks
* Demonstrates responsible use of technologies and online services, and knows a range of ways to report concerns Understands how search engines rank search results (AL)
#### Information Technology
* Collects, organizes, and presents data and information in digital content (AB)
* Uses criteria to evaluate the quality of solutions, can identify improvements making some refinements to the solution, and future solutions (EV)
Computational Thinking Concept: AB = Abstraction; DE = Decomposition; AL = Algorithmic Thinking; EV = Evaluation; GE = Generalisation
## Activity
* time: 20 min.
2016-04-13 17:27:45 +02:00
* [tutorial](/lessons/minesweeper/tutorial)
* [quiz](/lessons/minesweeper/quiz)
2016-03-26 00:47:20 +01:00