views:

122

answers:

2

Anyone have any advice for learning to program a 20 questions game? Something that could learn in the future but doesn't necessarily need to learn right away.

A: 

This SO post should help you on your way

http://stackoverflow.com/questions/887533/how-do-20-questions-ai-algorithms-work

code4life
+1  A: 

To start, you should look into search/sort algorithms (for example binary search, as mentioned in code4life's link's best answer).

Another more advanced topic you should look into is Machine Learning. Search algorithms will help your program attempt to find the correct answer, but machine learning algorithms will help your program correct its logic when it loses the game.

Finally, you should look into basic database manipulation, as depending on your chosen medium for the game, you'll want a good way to store your information. That is, you need to figure out a proper way to organize the data about all of the objects you can provide as answers, and decide on the most efficient way to query for them - in particular, this kind of efficiency will be important if your program will be used by many users as once (for example if you make it a webapp).

Cam