Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How does the web app work? Can I write a similar program, in a smaller scale, and if yes how?

share|improve this question

Sure, this is called an "expert system" and can be represented by a binary tree (in the case of yes/no questions only). Each non-leaf node in your tree is a question (e.g. Is it a mammal?). Each leaf is a final answer (e.g. Giraffe) with an implied question Is it a giraffe?. If the answer to this final question is yes, the user guessed the answer. If the answer is no, then the user should be prompted to input a new question (added to the database) where the answer is yes for the new answer (e.g. wombat) and no for the old answer (giraffe). The system grows in "intelligence" the more it is used.

share|improve this answer
Thanks.. will definitely attempt to write one of these programs. – Samrat Man Singh Feb 9 '11 at 4:55
Ahh the good ol' 20 questions exercise. Reminds me of late nights in the computer lab. – Michael Brown Feb 9 '11 at 5:33

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.