Missions‎ > ‎

Mission 2: Program a Guessing Game

This will be the first mission involving the Ruby programming language.  You can get started by downloading Hackety-Hack.  (If you want to try this at home, you may need the Windows version, which you can get here.)

Follow these steps:
  1. When the DMG (disk image) is done downloading, open it up.
  2. Drag the program onto your desktop (you won't be able to put it in Applications)
  3. Run Hackety Hack
  4. Click on the lightbulb and complete Lessons 1-3.  Take your time and try to understand what you're doing, rather than just copying the code.
The last part of Lesson 3 is the guessing game.  But I think it's missing some things.  Try to implement the following:
  • Keep the game running until the player guesses correctly. Hint: use a "while" loop.
  • Make the program generate a random integer up to 100 for the secret number.
  • Count the number of times the player guesses and let the player know how many guesses he's used
  • End the game after 10 tries and tell the player what the secret number was
Comments