/20questions

Play 20 questions against ChatGPT

Primary LanguageRuby

Play 20 Questions against ChatGPT

ChatGPT will happily play 20 questions against you, but because it has no hidden state it will modify its answer to best fit your questions. This command-line program uses the ChatGPT API to create a more realistic game.

You will need your own API keys to play.

Example session

Let's play 20 questions!  What level of difficulty would you like?
> hard

OK, I'm thinking of something hard.  You may ask yes or no questions only.

20> Is it alive?
Yes, it is alive.

19> Is it larger than a cat?
No.

18> Is it commonly found in a Zoo?
No.

17> Is it a hamster?
Yes, that's correct!  Good guess!

You have guessed hamster with 16 questions left