http://www.perlmonks.org?node_id=140779


in reply to Re (tilly) 1: (Golf) The Animal Game
in thread (Golf) The Animal Game

Nice solution, but it really gets thrown out if you pick the same two animals in alternation.
Starting a new game. does your animal have feathers? y Is your animal a chicken? n What is your animal? sparrow Please enter a question that would be true for a sparrow, but false fo +r a chicken: is your animal smaller than your fist? Do you want to continue? y Starting a new game. is your animal smaller than your fist? n Is your animal a chicken? y Do you want to continue? y Starting a new game. Is your animal a chicken? n What is your animal? sparrow Please enter a question that would be true for a sparrow, but false fo +r a chicken: is your animal smaller than your fist? Do you want to continue? y
In fact I can never get it to filter down beyond one quesiton. Surely it's trying to do a sort and should look like:
does your animal have fur? y is your animal smaller than your fist? y is your animal a mouse? y Do you want to continue?
but I can't get beyond:
the last question you answered: true -> your last animal false -> computer's previous guess.