Skip to Content

Binary guessing game activity

"May I read your mind?" We play a binary guessing game and read their minds. After explaining the game, we program it in Scratch, starting from a project that only requires a few key additions.

This is a popular and effective outreach activity that we have done many times.

Ask a volunteer to pick a number between 0 and 15.  Say that you will guess the volunteer's number based on his or her answers to 4 simple Yes or No questions.  You have a set of 4 cards and the question is the same for each card: "Do you see your number on this card?"  Each card has 8 numbers, as follows:

  • Card 1: 1, 3, 5, 7, 9, 11, 13, 15
  • Card 2: 2, 3, 6, 7, 10, 11, 14, 15
  • Card 3: 4, 5, 6, 7, 12, 13, 14, 15
  • Card 4: 8, 9, 10, 11, 12, 13, 14, 15

Each card represents a binary digit.  The numbers on the cards are those that can be represented if that bit is set to 1, which corresponds to a "Yes" answer from the volunteer.  The value of each card is the same as the first number in the lists above (Card 1 has the value 1, Card 2 has the value 2, Card 3 has the value 4, and Card 4 has the value 8).  For each "Yes" answer, add the value of the card to your guess (which begins at 0).  If the volunteer says "No" to all 4 cards, their number is 0.  The volunteer tells you his or her number in binary (Yes = 1, No = 0) and you convert it to decimal by adding together the values of the cards to which the volunteer said "Yes".  We have had sets of these cards printed (similar to the ones depicted in the sample project, with the card value on the back of the card for easy reference) and we give them out to all students once the game has been explained.

At this point, we tell them that they will program the binary guessing game, in Scratch.  We give them a start that includes all the text, so that nobody needs to type anything (which may slow down some).  What we leave for them to do is add the necessary logic to handle the Yes or No answer for each card.  We talk about what needs to happen during the game and how that can be expressed in Scratch.  We need to:

  • wait for a response to the question "Do you see your number?"  A person may answer either Yes (Y keypress) or No (N keypress).
  • process the reponse.  Nothing needs to be done if the answer is "No", only if the answer is "Yes", in which case the value of the card must be added to the guess.

Even younger students are able to complete the necessary additions without much trouble.  If there is time left, we ask students to make new costumes for "The Guesser" by taking and editing a picture of themselves.  We also suggest replacing the typed text with recorded sounds.  This is an appropriate activity if you have a group of students for about an hour.

 

Comments
Bernd Gärtner
Member

That's a great game, indeed! I made a Scratch project about it that demonstrates and explains the trick: http://scratch.mit.edu/projects/Kinderlabor/2284024

 

Bernd.