Project 8

Number Guessing Computer

The Number Guessing Computer may look like a clunky chunk of technology from years gone by, but it serves a useful function — it plays a good game of “Guess My Number!” Using a slider, the player tells the Number Guessing Computer a maximum value. The computer then randomly generates the secret number, a variable that changes from one game to the next. A player is asked to input a guess at the secret number, and IF-THEN conditionals are used to compare the guess to the secret number. A procedure based on the law of trichotomy tells the player whether the guess is too low, too high, or correct. If the guess is too low or too high, the procedure uses recursion to execute again, checking the player’s next guess until a correct guess is reached.

Brainstorm

This game doesn’t have to feature a computer thinking of a secret number. Change the character to an opponent against whom a player might enjoy guessing. Create any type of device or character to think of a number:

  • A genie in a bottle
  • A super-intelligent alien
  • Your favorite celebrity
  • Your pet
  • Your best friend

Start a New Project

Start a new project for your game as follows:

  1. 9781118940327-ma002.tif Start MicroWorlds EX.
  2. From the yellow MicroWorlds EX startup screen, select Free Mode.

    A new project opens.

  3. From the menu bar, choose File⇒New Project Size⇒Web Player.

Paint the Background

The background features the character ...

Get Coding For Kids For Dummies now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.