# rock paper scissors lesson

a game against the BBC micro:bit.

### @video td/videos/rock-paper-scissors-0

## Topic

Local Variables

## Quick Links

* [activity](/microbit/lessons/rock-paper-scissors/activity)
* [challenges](/microbit/lessons/rock-paper-scissors/challenges)
* [tutorial](/microbit/lessons/rock-paper-scissors/tutorial)

## 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

* **on shake** : [read more...](/microbit/reference/input/on-gesture)
* **local variable** : [read more...](/microbit/reference/variables/var)
* **create image** : [read more...](/microbit/reference/images/create-image)
* **math random** : [read more...](/microbit/js/math)
* **show image** : [read more...](/microbit/reference/images/show-image)
* **on button pressed** : [read more...](/microbit/reference/input/on-button-pressed)
* **show string** : [read more...](/microbit/reference/basic/show-string)
* **show number** : [read more...](/microbit/reference/basic/show-number)

## 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 return a random number
* learn how to show an image on the micro:bit's LED screen
* learn how to run code when an input button is pressed
* learn how to show a string on the LED screen
* learn how to show a number on the 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

* Uses filters or can perform single criteria searches for information.(AL)
* 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)

#### 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)
* Makes appropriate improvements to solutions based on feedback received, and can comment on the success of the solution (EV)
* Recognises ethical issues surrounding the application of information technology beyond school.

Computational Thinking Concept: AB = Abstraction; DE = Decomposition; AL = Algorithmic Thinking; EV = Evaluation; GE = Generalisation

## Activity

* time: 20 min.
* [activity](/microbit/lessons/rock-paper-scissors/activity)
* [tutorial](/microbit/lessons/rock-paper-scissors/tutorial)

## Extended Activity

* time: 20 min.
* [challenges](/microbit/lessons/rock-paper-scissors/challenges)

## Homework

* Extended Activity: [challenges](/microbit/lessons/rock-paper-scissors/challenges)

