8-Ball – Creating a “Magic 8 ball game using TouchDevelop
In this introduction to programming using TouchDevelop, students will create a “Magic 8-Ball” game. The game will work by asking the user to input a yes / no style question and will respond with one of it’s classic predictions such as: “Yes”, “Most likely” and “Outlook not so good”.
Suggested time: 100 mins
Learning Objectives:
Curriculum Mapping:
KS2:
KS3:
What you will need:
Introduction:
The Magic 8-ball is a fortune telling toy created by Mattel in the 1950s.
In this introduction to programming using TouchDevelop, students will create a “Magic 8-Ball” game. The game will work by asking the user to input a yes / no style question and will respond with one of it’s classic predictions such as: “Yes”, “Most likely” and “Outlook not so good”.
Suggested time: 100 mins
Learning Objectives:
- Understand and use sequence in an algorithm
- Understand and use selection in an algorithm (IF, Else and Else if)
- Understand and data structures in an algorithm (for example, Lists, Tables or Arrays)
- Understand the importance of comments in code
Curriculum Mapping:
KS2:
- Design, write and debug programs that accomplish specific goals; solve problems by breaking them into smaller parts. Select, use and combine a variety of software on a range of digital devices to design and create a range of programs.
- Use sequence, selection and repetition in programs; work with variables and various forms of input and output
- Use logical reasoning to explain how some simple algorithms work; detect and correct errors in algorithms and programs
KS3:
- Use two or more programming languages, at least one of which is textual, to solve a variety of computational problems.
- Make appropriate use of data structures [for example, lists, tables or arrays]; design and develop modular programs that use procedures or functions
What you will need:
- Web enabled device (PC, Tablet, Phone) with an up-to-date browser (Internet Explorer, Safari, Chrome)
- TouchDevelop Web App (www.touchdevelop.com)
Introduction:
The Magic 8-ball is a fortune telling toy created by Mattel in the 1950s.
Image by CRASH:Candy, used under a Creative Commons Attribution 2.0 Generic license (Flickr image link)
The concept is simple. Ask the 8-ball a yes or no question and the 8-ball will reply with answers such as “Yes”, “No”, “Without a doubt” etc. (Seemingly being able to predict the future)
The Magic 8 Ball is made up of 20 responses – 10 positive, 5 negative and 5 neutral. The 20 answers are:
Positive answers:
● It is certain ● It is decidedly so ● Without a doubt ● Yes definitely ● You may rely on it ● As I see it, yes ● Most likely ● Outlook good ● Yes ● Signs point to yes
Negative answers:
● Don't count on it ● My reply is no ● My sources say no ● Outlook not so good ● Very doubtful
Neutral answers:
● Reply hazy try again ● Ask again later ● Better not tell you now ● Cannot predict now ● Concentrate and ask again
According to Wikipedia: (http://en.wikipedia.org/wiki/Magic_8-Ball) “Using the coupon collector's problem in probability theory, it can be shown that it takes, on average, 72 outcomes of the Magic 8 Ball for all 20 of its answers to appear at least once.”
To find out more about the Magic 8-Ball game, click on the links below:
Lesson Outline:
In this introduction to programming using TouchDevelop, students will create a “Magic 8-Ball” game. The game will work by asking the user to input a yes / no style question and will respond with one of it’s classic predictions such as:“Yes”, “Most likely” and “Outlook not so good”.
Starter:
Direct students to one of the online Magic 8-Ball games listed below. Instruct students to ask the Magic 8-Ball a series of yes / no questions and note down some of the answers. Ask students to note down any repeat answers.
Note: Use these sites at your own risk. TouchDevelop.weebly.com is not responsible for the content of external Internet sites.
Online Magic 8-Ball games:
After a few minutes, stop the class and ask them to feedback their findings to the rest of the class.
Note down some of the students findings and ask the students how they think the game works. Try to draw out answers such as “answers are randomly generated” and “answers chosen from a list”.
Finally, inform students that they are going to create a Magic 8-Ball game that will appear to predict the future.
Activity 1:
Direct students to the link below and ask students to follow the instructions.
Tutorial:
Step-by-step tutorial (Opens directly inside touchdevelop):
8-Ball – Creating a Magic 8-Ball game using TouchDevelop (step-by-step tutorial)
PowerPoint tutorial:
The Magic 8 Ball is made up of 20 responses – 10 positive, 5 negative and 5 neutral. The 20 answers are:
Positive answers:
● It is certain ● It is decidedly so ● Without a doubt ● Yes definitely ● You may rely on it ● As I see it, yes ● Most likely ● Outlook good ● Yes ● Signs point to yes
Negative answers:
● Don't count on it ● My reply is no ● My sources say no ● Outlook not so good ● Very doubtful
Neutral answers:
● Reply hazy try again ● Ask again later ● Better not tell you now ● Cannot predict now ● Concentrate and ask again
According to Wikipedia: (http://en.wikipedia.org/wiki/Magic_8-Ball) “Using the coupon collector's problem in probability theory, it can be shown that it takes, on average, 72 outcomes of the Magic 8 Ball for all 20 of its answers to appear at least once.”
To find out more about the Magic 8-Ball game, click on the links below:
- Wikipedia (Magic 8-Ball) - http://en.wikipedia.org/wiki/Magic_8-Ball
- Magic 8-Ball.org - http://www.magic8ball.org
Lesson Outline:
In this introduction to programming using TouchDevelop, students will create a “Magic 8-Ball” game. The game will work by asking the user to input a yes / no style question and will respond with one of it’s classic predictions such as:“Yes”, “Most likely” and “Outlook not so good”.
Starter:
Direct students to one of the online Magic 8-Ball games listed below. Instruct students to ask the Magic 8-Ball a series of yes / no questions and note down some of the answers. Ask students to note down any repeat answers.
Note: Use these sites at your own risk. TouchDevelop.weebly.com is not responsible for the content of external Internet sites.
Online Magic 8-Ball games:
- Ask the Magic 8 Ball – http://eightball.tridelphia.net
- The Magic 8-Ball - http://lord.xopl.com/ulpage3a/8-ball.html
- Interactive Magic 8-Ball - http://www.magicmgmt.com/gary/magic8ball/index1.html
After a few minutes, stop the class and ask them to feedback their findings to the rest of the class.
Note down some of the students findings and ask the students how they think the game works. Try to draw out answers such as “answers are randomly generated” and “answers chosen from a list”.
Finally, inform students that they are going to create a Magic 8-Ball game that will appear to predict the future.
Activity 1:
Direct students to the link below and ask students to follow the instructions.
Tutorial:
Step-by-step tutorial (Opens directly inside touchdevelop):
8-Ball – Creating a Magic 8-Ball game using TouchDevelop (step-by-step tutorial)
PowerPoint tutorial:
8_ball_tutorial.pptx |
Worksheet:
magic_8_ball_tutorial.docx |
Extension:
1. Ask students to add comments to their script explaining how it works
2. Ask students to input all of the 20 classic answers. (See above) Hint: Students can change the answers if they wish however, they must keep to the format of 10 positive, 5 negative and 5 neutral answers
3. Challenge students to modify their script so that the 8-ball speaks the prediction out aloud using the Languages à speak text command. (See Chat-bot tutorial)
4. Challenge students to create an alternative version of the classic 8-Ball game in which the user has to shake their device (using the accelerometer features in TouchDevelop) to receive a prediction.
Plenary:
Direct students to swap places with a partner or person next to them and try out their Magic 8-Ball game. Instruct the students to suggest at least one improvement using the comment facility in TouchDevelop. After a few minutes, ask the students to return to their seats and make any suggested improvements.
Homework:
Students can continue to work on their Magic 8 Ball game and publish their script when they have finished.
Licence:
Unless otherwise specified, everything in this repository is covered by the following licence:
1. Ask students to add comments to their script explaining how it works
2. Ask students to input all of the 20 classic answers. (See above) Hint: Students can change the answers if they wish however, they must keep to the format of 10 positive, 5 negative and 5 neutral answers
3. Challenge students to modify their script so that the 8-ball speaks the prediction out aloud using the Languages à speak text command. (See Chat-bot tutorial)
4. Challenge students to create an alternative version of the classic 8-Ball game in which the user has to shake their device (using the accelerometer features in TouchDevelop) to receive a prediction.
Plenary:
Direct students to swap places with a partner or person next to them and try out their Magic 8-Ball game. Instruct the students to suggest at least one improvement using the comment facility in TouchDevelop. After a few minutes, ask the students to return to their seats and make any suggested improvements.
Homework:
Students can continue to work on their Magic 8 Ball game and publish their script when they have finished.
Licence:
Unless otherwise specified, everything in this repository is covered by the following licence:
TouchDevelop "Magic 8-Ball" lesson is licenced under a Creative Commons Attribution 4.0 International License.