Need Your Input.


Recommended Posts

In Computer Science class we are learning simple coding in QBasic, again nothing fancy. For a project we have to create a program that will ask questions and try to guess what your thinking (eg baseball team). It has to guess the right answer in <= 20 questions. I needed some I ideas on what I could make that program guess. I can't think of anything.

Link to post
Share on other sites
In Computer Science class we are learning simple coding in QBasic, again nothing fancy. For a project we have to create a program that will ask questions and try to guess what your thinking (eg baseball team). It has to guess the right answer in <= 20 questions. I needed some I ideas on what I could make that program guess. I can't think of anything.

Watch me over-think this and suggest an AI solution.

In principle you can kludge together something like a bayesian network without too much trouble. You have two databases (arrays, lists, files, whatever floats your boat). One contains all of the objects the program knows about (e.g. baseball teams) and the other contains all of the questions the program can ask (e.g. "Is it a sport?"). Then you have a set of relations that associate a probability with each combination of questions, answers, and objects. For example, if the answer to the question "Is it a sport?" is "No" the probability that baseball is the correct object is 0. If the answer is yes... er... the math gets complicated. You recalculate the probabilities after each question and use them to guide the questions until you're confident enough to commit to an object. (Real bayesian networks are nicer but I can't imagine putting "graph" and "QBasic" in the same sentence.)

(You could use a hit-or-miss system. Associate a counter with every object. Increment or decrement the counter after each question to indicate an increase to decrease in the probability that it's the correct object. The object with the highest count is the current best guess. Undoubtably broken but much easier.)

Link to post
Share on other sites

In Computer Science class we are learning simple coding in QBasic, again nothing fancy. For a project we have to create a program that will ask questions and try to guess what your thinking (eg baseball team). It has to guess the right answer in <= 20 questions. I needed some I ideas on what I could make that program guess. I can't think of anything.

Watch me over-think this and suggest an AI solution.

In principle you can kludge together something like a bayesian network without too much trouble. You have two databases (arrays, lists, files, whatever floats your boat). One contains all of the objects the program knows about (e.g. baseball teams) and the other contains all of the questions the program can ask (e.g. "Is it a sport?"). Then you have a set of relations that associate a probability with each combination of questions, answers, and objects. For example, if the answer to the question "Is it a sport?" is "No" the probability that baseball is the correct object is 0. If the answer is yes... er... the math gets complicated. You recalculate the probabilities after each question and use them to guide the questions until you're confident enough to commit to an object. (Real bayesian networks are nicer but I can't imagine putting "graph" and "QBasic" in the same sentence.)

(You could use a hit-or-miss system. Associate a counter with every object. Increment or decrement the counter after each question to indicate an increase to decrease in the probability that it's the correct object. The object with the highest count is the current best guess. Undoubtably broken but much easier.)

Umm....

Not to be rude or anything, but I have no idea what you just said. :unsure:

Link to post
Share on other sites
Umm....

Not to be rude or anything, but I have no idea what you just said. :unsure:

That's fine, I was indulging myself.

Just so I'm clear were you asking a programming question? If you just wanted ideas for the guessing game send a private message to hitest and tell him to move this thread back to Open Chat. And maybe see if he'll delete everything but your original post to clear the air. And yell at him for both of us.

Edited by jcl
Link to post
Share on other sites
In Computer Science class we are learning simple coding in QBasic, again nothing fancy. For a project we have to create a program that will ask questions and try to guess what your thinking (eg baseball team). It has to guess the right answer in <= 20 questions. I needed some I ideas on what I could make that program guess. I can't think of anything.

For the project, are you giving more specific parameters to follow? That seems to general and imposible to do with twenty questions.

Edited by shanenin
Link to post
Share on other sites

20 questions, on baseball teams.

You are going to want to compile 20 pieces of data data on each team that leads to a unique answer. Let me get you started

The logic goes something like this:

Ask

What league is the team in? (cuts the possibilities in half)

Is their mascot an animal? (Eliminates some more)

Is the team from the north or south? (Eliminates more)

Etc.

Etc.

Computer prints:

You are thinking of <Print team name>. See, computers can read your mind.

Get it?

BH

Link to post
Share on other sites

Heh, did this for fun myself, though I used NHL teams rather than Baseball teams and I used Ruby rather than Basic. I did this for fun, not masochism after all.

I simply looked at the options that have not been eliminated and ranked the questions on how close they come to splitting the remaining options in half. In a tie I select a question at random. If none of the questions will refine the search further, or it is the 20th question, I select a team at random.

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...