Results 1 to 11 of 11
  1. #1
    2 Star Lounger
    Join Date
    Feb 2001
    Location
    Shetland Isles, Shetland, Scotland
    Posts
    153
    Thanks
    3
    Thanked 1 Time in 1 Post
    Many years ago, I came across an Access DB that played the "name the animal" game

    Older readers might remeber an old mainframe game that asked you questions like "does it have a trunk", if you answered "yes" it guessed "elephant", if it got it wrong it asked you what the answer really was (narwhal) and to supply a question that "would differentiate betwen an elephant and a narwhal".

    I found an identical implimentation of this mainframe game on an access training website that showed how the game was written in access with just (from memory) three tables, two queries and a form.

    This was years ago, and I know I'm clutching at straws here but I could use the same DB setup to get to repairs diagnostic codes that I'm working on. Basically a Q&A db that the user can add to as systems become more complex.

    Any ideas?
    Please don't ask me what a mainframe is, I feel old enough already.

    Jim MacLeod
    Shetland Isles

  2. #2
    Super Moderator WebGenii's Avatar
    Join Date
    Jan 2001
    Location
    Redcliff, Alberta, Canada
    Posts
    4,066
    Thanks
    2
    Thanked 5 Times in 5 Posts
    hmm, so I'd use the form to build the query to return the answer.

    Are you wanting to save the questions to offer each user?
    [b]Catharine Richardson (WebGenii)
    WebGenii Home Page
    Moderator: Spreadsheets, Other MS Apps, Presentation Apps, Visual Basic for Apps, Windows Mobile

  3. #3
    Super Moderator
    Join Date
    Aug 2001
    Location
    Evergreen, CO, USA
    Posts
    6,623
    Thanks
    3
    Thanked 60 Times in 60 Posts
    Well, I didn't find an Access database solution, though I'm sure more than one person has done that sort of thing. But I did find this Programming Project Class Practical 4 which gives some tips about how to create such a program. Most solutions build a tree of sorts to chain down the set of questions. And this same concept is employed in some of the self-help phone and web debugging systems. Frankly most of the ones I've used never get to the solution of my problem.
    Wendell

  4. #4
    2 Star Lounger
    Join Date
    Feb 2001
    Location
    Shetland Isles, Shetland, Scotland
    Posts
    153
    Thanks
    3
    Thanked 1 Time in 1 Post
    Quote Originally Posted by Catharine Richardson - WebGenii View Post
    hmm, so I'd use the form to build the query to return the answer.

    Are you wanting to save the questions to offer each user?
    Hi Catharine. Thanks for your reply. Yes, the animal game stored the questions, the eventual outcome was a spookily accurate animal naming game. Due to vandalism by students it was reset every now and then, it started with a DB of 20 or so animals & questions (Am I the only one who can remenber this, it ran on a DEC2080, some of the terminals didn't even have screens)

    Quote Originally Posted by WendellB View Post
    Well, I didn't find an Access database solution, though I'm sure more than one person has done that sort of thing. But I did find this Programming Project Class Practical 4 which gives some tips about how to create such a program. Most solutions build a tree of sorts to chain down the set of questions. And this same concept is employed in some of the self-help phone and web debugging systems. Frankly most of the ones I've used never get to the solution of my problem.
    Hi Wendel, Thanks for your reply. I'll have a look at that site. I take your point about these call centre scripts never getting to the real problem but I think that my application might work as they're very objective questions.

    Jim

  5. #5
    New Lounger
    Join Date
    Jan 2010
    Location
    Lilydale, Victoria, Australia
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I'll put you out of your misery - I remember it too. Can't help you with where it came from though. Why don't you try interrogating one of those "name that animal" games?

  6. #6
    New Lounger
    Join Date
    Dec 2009
    Location
    Santa Monica, CA
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts
    What you're looking for is generically known as an "expert system." I'm sure if you do a search you'll be able to find all sorts of references (you can start with Wikipedia for a general synopsis). I do have a couple of books that I got 25 years ago, one that uses Pascal and I think the other uses C although it could have been BASIC (I'll have to dig around for it when I get to my office).

    As I remember, the "name that animal" type of system allowed the knowledge base to grow if the system didn't have the correct answer in its database. For example:
    Is the animal a bird?
    Yes
    Can the animal fly?
    No
    Is the animal a penguin?
    No

    If you answered no, then the program would ask what animal you were thinking of, and then ask you to enter a question that would grow its knowledge base:
    What animal were you thinking of?
    ostrich
    Enter a question distinguishes an ostrich from a penguin:
    Does the animal have long legs?

    More complex systems assign a certainty factor to each rule (i.e., a probability that a certain hypothesis is correct).

  7. #7
    2 Star Lounger
    Join Date
    Feb 2001
    Location
    Shetland Isles, Shetland, Scotland
    Posts
    153
    Thanks
    3
    Thanked 1 Time in 1 Post
    Thanks, I'll get searching.

  8. #8
    New Lounger
    Join Date
    Dec 2009
    Location
    Brockport, NY, USA
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts
    That reminds me of this site.. http://www.20q.net/
    I would be neat to have that as an Access DB too..

  9. #9
    5 Star Lounger AndrewKKWalker's Avatar
    Join Date
    Apr 2001
    Location
    Cambridge, UK
    Posts
    1,020
    Thanks
    0
    Thanked 3 Times in 3 Posts
    There used to be a version for BASIC on the old BBC B Computer.
    Not sure that helps but someone might have a copy.

    I also found this

    http://www.atariarchives.org/basicga...age.php?page=5

    I think there used to be a copy in a very old Kemney and Kurtz book on Basic programming, but for the life of me I have no idea where my copy went.
    Andrew

  10. #10
    New Lounger
    Join Date
    Aug 2010
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Hi Jim,

    I implemented such a game years ago in Amiga BASIC, and later in Python. For the Python version I found that the dictionary data structure [http://diveintopython.org/getting_to...ionaries.html] worked nicely:

    As the article that WendellB linked to says, you're constructing a binary tree with each non-leaf node being a question, and each leaf node an answer.

    I used the 'yes-no' path as the key value in the dictionary: eg. 'ynny', so I just concatenate the user's answer on to the key value to look up the next node in the tree. Each node then is a 2-tuple -- 2 values: 'q' or 'a' for question/answer; and the string which is the question or the answer.

    This makes the main questioning loop very simple:

    Code:
        
        # path is the sequence of Yes/No answers to the current point in the tree.
        # It is used as the Key in the database.
        path = ""
        # Get the first question - Value is a 2-tuple
        QorA, question = data["root"]
    
        # This is the main ask-question loop: made simple by a nice data structure.
        while QorA == 'q':
            a = GetYesNoResponse(question)
            path = path + a
            QorA, question = data[path]
    Then you make your guess and process user input if your guess was wrong:

    Code:
        # Found a node - guess this animal
        guess = question  #rename for clarity
        
        print "Is your animal " + Article (guess) + guess + "?"
        a = GetYesNoResponse()
        if a == 'y':
            print "Wow! I guessed your animal!!"
            print
            sleep (1)
            print "Thank-you for thinking of an animal for me."
        else:
            ## New animal
            print "I give up!"
            newAnimal = ""
            while newAnimal == "":
                newAnimal = raw_input("Please tell me what animal you were thinking of: ")
    
            newAnimal = string.capitalize(newAnimal).strip()
            print "Now, please type a question that will distinguish"
            print Article(newAnimal) + newAnimal + " from " + Article(guess) + guess + ":"
    
            newQuestion = GetQuestion()
            print "\n\n", newQuestion
            print "\nNow please tell me whether the correct answer for "
            print Article(newAnimal) + newAnimal + " is Yes or No."
    
            newAnswer = GetYesNoResponse()
            if newAnswer == 'y':
                oldAnswer = 'n'
            else:
                oldAnswer = 'y'
    Finally update the data structure:

    Code:
            # Store the new information
            # (replacing the current node with the new question)
            data[path] = 'q', newQuestion
            data[path+newAnswer] = 'a', newAnimal
            data[path+oldAnswer] = 'a', guess
            
            print "Thank-you for teaching me a new animal."
    You could, of course, use a binary tree class instead, although I think what I've shown above might more readily convert to an Access implementation if that is your hope.

    Craig.

  11. #11
    2 Star Lounger
    Join Date
    Feb 2001
    Location
    Shetland Isles, Shetland, Scotland
    Posts
    153
    Thanks
    3
    Thanked 1 Time in 1 Post
    Hi,

    thanks for that Craig, I like the idea of of the "ynny" string, it might even have potential if the questions were multiple choice i.e. a "abbcab" string.

    FYI this started as a real work example, I abandoned it for work but I started playing with it as a bit of a hobby. My challenge was to get a y/n system working with the least possible forms/queries/tables. If you were an Amiga programmer, you'll remember the days of memory restrictions!

    Your answer has given me loads of ideas, thanks.

    Jim

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •