jdpatel Posted January 26, 2006 Report Share Posted January 26, 2006 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. Quote Link to post Share on other sites
hitest Posted January 27, 2006 Report Share Posted January 27, 2006 Hi, I'm moving this to Programming Quote Link to post Share on other sites
jcl Posted January 27, 2006 Report Share Posted January 27, 2006 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.) Quote Link to post Share on other sites
jdpatel Posted January 27, 2006 Author Report Share Posted January 27, 2006 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. Quote Link to post Share on other sites
jcl Posted January 27, 2006 Report Share Posted January 27, 2006 (edited) Umm....Not to be rude or anything, but I have no idea what you just said. 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 January 27, 2006 by jcl Quote Link to post Share on other sites
Naming is hard Posted January 27, 2006 Report Share Posted January 27, 2006 Keep it simple ^^ have it guess a number Quote Link to post Share on other sites
hitest Posted January 27, 2006 Report Share Posted January 27, 2006 And yell at him for both of us.LOL *****hitest runs and hides******* Quote Link to post Share on other sites
JDoors Posted January 27, 2006 Report Share Posted January 27, 2006 Favorite color, sport, .... umm, that's all I can think of. Quote Link to post Share on other sites
shanenin Posted January 27, 2006 Report Share Posted January 27, 2006 (edited) 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 January 27, 2006 by shanenin Quote Link to post Share on other sites
Brian_Holiday Posted January 28, 2006 Report Share Posted January 28, 2006 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 startedThe logic goes something like this:AskWhat 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 Quote Link to post Share on other sites
Hai-Etlik Posted January 29, 2006 Report Share Posted January 29, 2006 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. Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.