Ok, so a few people have mentioned that they remember playing the same game I got the idea from back in the day on an Apple something or other. Zaxo thinks he might even have the original source code in a book some place. Other people have asked how the logic tree works.

1,1 /\ / \ Y / \ N / \ 2,1 2,2 /\ / \ Y / \ N Y / \ N / \ / \ 3,1 3,2 3,3 3,4

It starts with a root question at ($x = 1,$y = 1) (it is very important to pick a good root question because you are eliminating half of the possibilities every time you answer a question. To get to the next entry in the logic tree, you need only determine if the answer was yes or no. $x always increases by 1, and $y either becomes 2 * $y or (2 * $y) - 1. You continue through the logic tree until you find a Guess and not another Question. It is then a simple matter of modifying the logic tree with the new information to get "smarter".

I want to remind everyone that my code is a guess as to what the original looks like. It was many years ago, and I am sure it could be much cleaner. Some ideas that I had are:

  • Improve the I/O interface
  • Improve the regex's to ensure proper capitalization
  • Check dict if possible for typos on animals Anyone wanting to play around with these or your own ideas are more than welcome. Improvement on the logic tree would greatly be appreciated.

    Thanks,

    Limbic~Region


    In reply to Re: AI Animals by Limbic~Region
    in thread AI Animals by Limbic~Region

    Title:
    Use:  <p> text here (a paragraph) </p>
    and:  <code> code here </code>
    to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.