Personal tools

Haskell Quiz/Animal Quiz

From HaskellWiki

< Haskell Quiz(Difference between revisions)
Jump to: navigation, search
m
 
 
(3 intermediate revisions by 3 users not shown)
Line 11: Line 11:
 
==Solutions==
 
==Solutions==
   
* [[Haskell Quiz/Countdown/Solution Animal Quiz|Jethr0]]
+
* [[Haskell Quiz/Animal Quiz/Solution Jethr0|Jethr0]]
  +
* [[Haskell Quiz/Animal Quiz/Solution TJ|TJ]]
  +
* [[Haskell Quiz/Animal Quiz/Solution Ninju|Alex Watt]]
  +
  +
[[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).

[edit] 1 The Problem

[edit] 2 Solutions