Gallery
Debug 4.2. Mind Reader with starter code
Share
Explore
Debug 4.2. Mind Reader with starter code

icon picker
The Task

Activity: Debug 4.1 Mind Reader 🐞 🪄

There is a bug report about this program. It is pretends to be an AI program that can read someone’s mind.
Here is the trick it tries to use:

How to Read Someone’s Mind With Math (Math Trick)

This trick is a good one to start with, as its one of the simplest. There’s just enough substance to make it impressive however, so take the following steps and get them wondering how you knew it:
Ask the person to think of a number between 1 and 9.
Tell them to add the number to itself.
Ask them to multiply the new number by 5.
Have them divide the current number by the original number.
Instruct them to subtract 7 from the current number.
“Guess” the answer! If the prior steps were done correctly, the right answer will always be 3!

Start here

Run the program and try it out. It gets the trick wrong.
Unfortunately we think that the coders have not implemented the calculations properly.
Use the description of the trick above and the comments in the code to work out what has gone wrong.
Fix the bugs, get a partner to play the trick on and check it works.
Remember to right click on your code and add a comment explaining what was wrong and how you fixed it.
Good luck! 🍀
If you like this kind of trick, have a look at this

sample output

I'm going to read your mind!

Think of a mystery number 1-9, type it in: 4

Add your number to itself
. . still reading your mind . .


Multiply the new number by 5
. . still reading your mind . .


Divide the current number by the original number
. . still reading your mind . .


Subtract 7 from the current number
. . still reading your mind . .



The answer should be 3 !!!!
Share
 
Want to print your doc?
This is not the way.
Try clicking the ⋯ next to your doc name or using a keyboard shortcut (
CtrlP
) instead.