- Reset Game
- Book
- BASIC
-
Bagels
Original Resources
Download the original BASIC code. Check out the original page the text below was taken from in the Book.
Instructions From the Book
"In this game, the computer picks a 3-digit secret number using the digits 0 to 9 and you attempt to guess what it is. You are allowed up to twenty guesses. No digit is repeated. After each guess the computer will give you clues about your guess as follows:
PICO: One digit is correct, but in the wrong place.
FERMI: One digit is in the correct place.
BAGELS: No Digit is correct.
You will learn to draw inferences from the clues and, with practice, you'll learn to improve your score. There are several good strategies for playing Bagels. After you have found a good strategy it should not take more than eight guesses to get any number.
The original authors of this program are D. Resek and P. Rowe of the Lawrence Hall of Science, Berkly, California."
Modifications For This Version
For the most part, the game play is the same. However, I've added the option for the user to be able to choose how many digits the computer will think of. Also, I've removed the 20-guess constraint.
Additionally, I decided to have a little fun with the numbers. Upon winning the game, the computer will reveal to you what its thought of number means to it perhaps giving insight into why the computer chose it.
Technical Stuff
This version is written in PHP which means that for every guess the user makes, there is a POST, a page refresh, and a ping to my server. Session variables keep track of everything. Obviously this is not ideal.
The main reason I went with PHP is to keep the computer's thought of number from prying eyes. If written in JavaScript, savvy JavaScript users would be able to find the secret number. I still may build a JS version in the future, but for now, PHP will suffice. Until then . . .
Enjoy Bagels!