I thought about a project idea and I came up with this: 20 questions. I have no clue how to start. I think that a simple knowledge base is necessary, along with a way for it to learn. also, how would it ask questions? it would have to know some sort or grammar for the questions to make sense.

What do you think??

I think that a file creation system might be helpful.

7 Years
Discussion Span
Last Post by JSPMA1988

Instead of having the user input a statement, have the program ask a question and the user reply with yes or no. At which point, if the answer is yes, you lead down one road of possibilities to what the answer is. Otherwise, head the other direction. Having the user to input an answer for the program to comprehend might be a bit much for a simple '20 Questions'.

e.g. Answer: Pencil

Q1. Person(A), Place(B) or Thing(C).
Input: C
Q2. Solid Object?(A) Non-solid Object (B)
Input: A
Q3. Human daily use?(A) Or not daily use?(B)
Input: A
Q4. Used for communication?(A) Or not used for communication(B)
Input: A
Q5. Do you write on it?(A) Or do you not write on it. (B)
Input: B
Q6. Do you write with it?(A) Or do you not write with it? (B)
Input: A
Is the answer: A pencil?

That's very simplistic and very narrowed approach to the answer but -more of the set up that I was thinking-. This would be one approach, definitely may not be the best approach, but one that could possibly do the job. Good luck!


This kind of game requires massive lists of objects used in the real world. The better implementations of this game, at least that I've seen, have been done in Lisp. But it is possible to code this in any language.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.