Difference between revisions of "Haskell Quiz/Animal Quiz"

From HaskellWiki
Jump to: navigation, search
m (fixed link to my solution)
Line 11: Line 11:
* [[Haskell Quiz/Countdown/Solution Animal Quiz|Jethr0]]
* [[Haskell Quiz/Animal Quiz/Solution Jethr0|Jethr0]]

Revision as of 13:36, 23 December 2006

Animal Quiz (#15)

It works like this. The program starts by telling the user to think of an animal. It then begins asking a series of yes/no questions about that animal: does it swim, does it have hair, etc. Eventually, it will narrow down the possibilities to a single animal and guess that (Is it a mouse?).

If the program has guessed correctly, the game is over and may be restarted with a new animal. If the program has guess incorrectly, it asks the user for the kind of animal they were thinking of and then asks for the user to provide a question that can distinguish between its incorrect guess and the correct answer. It then adds the new question and animal to its "database" and will guess that animal in the future (if appropriate).

The Problem