# magic 8 lesson

a fortune teller game with the BBC micro:bit.

### @video td/videos/magic-8-1

## Topic

If (Conditionals)

## Quick Links

* [activity](/microbit/lessons/magic-8/activity)
* [quiz](/microbit/lessons/magic-8/quiz)
* [quiz answers](/microbit/lessons/magic-8/quiz-answers)
* [challenges](/microbit/lessons/magic-8/challenges)
* [tutorial](/microbit/lessons/magic-8/tutorial)

## Class

Year 7

## Prior learning/place of lesson in scheme of work

Learn how to creating **conditionals**, `if condition do` to conditionally run code depending on whether a condition is true or not. We will be learning how to create a fortune telling app using local variable and conditionals (If), input on shake as well as simple commands, such as show string, show number, and clear screen.

## Documentation

* **show string** : [read more...](/microbit/reference/basic/show-string)
* **show number** : [read more...](/microbit/reference/basic/show-number)
* **on shake** : [read more...](/microbit/reference/input/on-gesture)
* **clear screen** : [read more...](/microbit/reference/basic/clear-screen)
* **local variable** : [read more...](/microbit/reference/variables/var)
* **random number** : [read more...](/microbit/js/math)
* **if** : [read more...](/microbit/reference/logic/if)

## Objectives

* learn how to show a string on the LED screen
* learn how to show a number on the LED screen
* learn how to learn how to turn off all the LED lights on the LED screen
* learn how to use the input on shake
* learn how to learn how to create a local variable to store data so that you can use it later in your code
* learn how to learn how to return a random number
* learn how to learn how to conditionally run code depending on whether a condition is true or not

## 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)
* Recognises that different solutions exist for the same problem (AL) (AB)  Understands that iteration is the repetition of a process such as a loop (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 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)

#### 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/magic-8/activity)
* [tutorial](/microbit/lessons/magic-8/tutorial)
* [quiz](/microbit/lessons/magic-8/quiz)

## Extended Activity

* time: 20 min.
* [challenges](/microbit/lessons/magic-8/challenges)

## Homework

* Extended Activity: [challenges](/microbit/lessons/magic-8/challenges)

