Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
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":



    • Are you posting in the right place? Check out Where do I post X? to know for sure.
    • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
      <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
    • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
    • Want more info? How to link or How to display code and escape characters are good places to start.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Domain Nodelet?
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this?Last hourOther CB clients
    Other Users?
    Others sharing their wisdom with the Monastery: (6)
    As of 2024-04-23 09:32 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      No recent polls found