Report bug
Cross Word
Word Search
Word Scramble
Secret Code
Word Match
Fresh Words

A long time ago (around 1974) when I was in high school, I learned a logic game called Bagels. This is a simple game that can be played with just pencil and paper or (for those with good memory) without any props at all.

The game is deceptively simple. If you play well though, it can be fairly deep.



Do you want to take the role of choosing a number or guessing my number?




  1. There are two opponents. One picks a number, and the other one attempts to guess the number. The person picking the number must give accurate answers to the guesses.
  2. The person picking a number picks a three digit number. In this version, there may be no leading zeros, and digits may not be repeated.
  3. The person guessing the number gives three digit numbers.
  4. The person who picked the number answers:
    • Fermi -- One of the digits in the guess matches one of the digits in the answer, and it is in the right position.
    • Pico -- One of the digits in the guess matches one of the digits in the answer, but the digit is not in the right place.
    • Bagels -- None of the digits in the guess match any of the digits in the answer.
    Multiple answers may come out of a single guess. For examples, look at the table below:
    Picked NumberGuessAnswer
    123456Bagels -- None of the digits match.
    123345Pico -- The 3 matches, but is in the wrong place.
    123543Fermi -- The 3 matches, and is in the right place.
    123321Pico Pico Fermi -- The 3 and 1 match, but are in the wrong place, and the 2 matches and is in the right place.
  5. Players take turns holding each role. The one who averages the fewest guesses is the better player.


I learned this is a math class about 1974. Diane Resek and Pete Rowe of the Lawrence Hall of Science and Math in Berkeley implemented this games in BASIC in the early 1970's. For an example, see: or (look for BAGLES).

Both Diane Resek and Pete Rowe worked at Lawrence Hall of Science at the time. Pete Rowe was the head of the computer program there, and Diane Resek taught math. Resek taught Rowe the game, and he programmed it for LHS. Resek learned the game from Bill Rupley (also a math teacher at the time), who learned it on the East Coast.

The board game Mastermind uses similar rules and was introduced in 1970. The Wikipedia article mentions an older game called Bulls and Cows which may "date back a century or more". A quick read of the rules show that this is the basically the same game as Bagels. There are computer programs implementing this called "moo" dating back to 1968. This game also seems to be known as Fiddle Faddle Flop.

The book named Family Math describes Bagels.

Donald Knuth wrote a paper The Computer as Master Mind. J. Recreational Mathematics, 9 (1976-77), 1-6. describing an optional solution for Master Mind. He refers to the "Bulls and Cows" game as a similar game with a computer implementation in 1968. Another paper by Thomas M. Fiore, Alexander Lang, and Antonella Perucca titled Tactile Tools for Teaching: An Implementation of Knuth's Algorithm for Mastering Mastermind describes a circular slide rule for implementing Knuth's algorithm.

If you have any question about the Bagels, send mail to

If you see something which looks like a bug, please report that as well.