Difference between revisions of "Haskell Quiz/Animal Quiz"

From HaskellWiki
Jump to navigation Jump to search
m
 
Line 13: Line 13:
 
* [[Haskell Quiz/Animal Quiz/Solution Jethr0|Jethr0]]
 
* [[Haskell Quiz/Animal Quiz/Solution Jethr0|Jethr0]]
 
* [[Haskell Quiz/Animal Quiz/Solution TJ|TJ]]
 
* [[Haskell Quiz/Animal Quiz/Solution TJ|TJ]]
  +
* [[Haskell Quiz/Animal Quiz/Solution Ninju|Alex Watt]]
   
 
[[Category:Haskell Quiz|Animal Quiz]]
 
[[Category:Haskell Quiz|Animal Quiz]]

Latest revision as of 22:50, 14 August 2008

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

Solutions