1.8 KiB
1.8 KiB
rock paper scissors lesson
a game against the BBC micro:bit #var #image #button #string #number #docs
@video td/videos/rock-paper-scissors-0
Topic
Local Variables
Quick Links
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
input.onGesture(Gesture.Shake, () => {
})
Math.random(3)
let x = 0
basic.showLeds(`
. . . . .
. . . . .
. . # . .
. . . . .
. . . . .
`)
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