Rules
The computer picks a secret number made of unique digits from 0-9 (the first digit can be 0). When you submit a guess with the same number of digits, the computer gives you a hint:
- Strike (S): the number of digits that are correct and in the correct position
- Ball (B): the number of digits that are correct but in the wrong position
- Out: zero strikes and zero balls (none of your digits appear in the secret number at all)
For example, if the secret number is 1234 and you guess 1243, the 1 and 2 are correct and in the right spot (2 strikes), while the 4 and 3 are correct digits but swapped (2 balls) β so the result is 2 strikes, 2 balls. Once every digit is a strike (for example, 4 strikes in a 4-digit game), you've won. This is the same game known internationally as "Bulls and Cows."
Tips for solving it efficiently
In your first few guesses, try a wide variety of digits to figure out which ones are actually in the secret number. Once you know which digits are included, try rearranging their order and watching how the strike count changes β that lets you logically narrow down each digit's exact position.
Frequently Asked Questions
Can I guess with a repeated digit?
No. The secret number is always made of unique digits, and your guesses must also use all different digits β a guess with a repeated digit will be rejected.
Why is this game called "baseball"?
The terms come from baseball: a digit that's correct and in the exact right spot is a "strike," while a correct digit in the wrong spot is a "ball," borrowing baseball scoring language. It's a long-loved pencil-and-paper logic game, and closely related to the internationally known game "Bulls and Cows" (or "Mastermind" played with digits instead of colored pegs).