You might know of a famous game called Animals.

The player has an animal in his/her mind and the computer keeps asking
questions until it gets the right animal or it fails to do so, in
which case it asks the player to input a question that might
distinguish the last animal from the player's animal and the
appropriate yes/no answer. The knowledge base size increases.

This program is trivial in prolog and you can see it at
http://www.amzi.com/articles/prolog_fun.htm (look for "animals")

<quote>
?- go.
Does it have fur? yes
Is it a mouse? no
What animal were you thinking of?
dog
What is a yes/no question that distinguishes them?
Does it bark?
For a dog the answer is: yes
Play again? yes
Does it have fur? yes
Does it bark? yes
Is it a dog? yes
Play again? no
yes
?-
</quote>

What is the general approach in J with this type of tree structure
problem(I think I have seen an APL2 implementation a few months ago
but didn't read it carefully since I don't understand APL)? Does
anyone have a reference program of Animals in J?
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to