🔢 猜數字
Guess the Number

輸入不重複的 4 位數字,透過幾 A 幾 B 的提示,推理出正確答案!
Enter a 4-digit number with no repeating digits and use xA xB clues to deduce the correct answer!

猜測 Guesses {{ attempts }}
剩餘 Left {{ remaining }}
{{ msg.text }}
{{ history.length - idx }} {{ entry.guess }} {{ entry.A }}A {{ entry.B }}B
可能結果 ({{ remaining }})
{{ r }} ...還有 {{ moreCount }} 筆
🎉
恭喜答對!Congratulations!
{{ attempts }} 猜測次數 Guesses

 遊戲操作說明
How to Play

  • 開始遊戲:畫面載入即開始新一輪猜數字遊戲,系統自動產生一組 4 位不重複的數字
    Start Game: A new game begins on page load with a randomly generated 4-digit non-repeating number
  • 輸入數字:直接用鍵盤輸入 4 個不重複的數字
    Input Number: Use the keyboard to enter 4 unique digits
  • 提交答案:按下「送出」後系統會回饋結果為幾 A 幾 B(正確位置與數字)
    Submit Answer: Click “Submit” to get feedback in the format of xA xB
  • 結果說明:A 表示正確數字且位置正確,B 表示正確數字但位置錯誤
    Result Explanation: A = correct digit and position, B = correct digit but wrong position
  • 歷史紀錄:每次猜測會紀錄在下方,包括猜的數字與回饋結果
    History Log: Each guess and result will be recorded for reference
  • 提示功能:點擊「顯示可能組合」會依照歷史篩選出符合條件的候選答案
    Hint: Use “Show Possibilities” to filter remaining valid guesses based on history
  • 重新開始:點選「重新開始」即可開啟新一輪遊戲,答案也會重新生成
    Restart Game: Click “Restart” to start a new round with a new answer

 什麼是猜數字遊戲?
What is Guess the Number?

猜數字(Bulls and Cows)是一種邏輯與記憶並用的益智遊戲,玩家需要在每次系統給出的回饋下,逐步推理出正確的 4 位數字。

“Guess the Number”, also known as “Bulls and Cows”, is a classic logic game where players deduce the correct 4-digit number through iterative guesses and system feedback.

 遊戲特色
Game Features

  • 系統自動生成隨機答案,數字不重複Random 4-digit answer with non-repeating digits
  • 即時回饋幾 A 幾 B 幫助邏輯推理Real-time xA xB feedback guides logic deduction
  • 歷史猜測紀錄清楚可視Clear guess history to support tracking and strategy
  • RWD 響應式設計,手機與電腦皆可流暢操作Fully responsive UI for mobile and desktop
  • 答案眼睛圖示可切換顯示與隱藏Toggle answer visibility via eye icon for development/debug

 適用情境
When to Use?

  • 訓練邏輯推理與排除法技巧Train logical thinking and elimination strategies
  • 培養小朋友的數字觀念與耐心Build number sense and patience in children
  • 親子、同儕互動的趣味競賽遊戲Fun competitive game for friends and family
  • 適合作為數學或邏輯課堂練習Great for math or logic class warm-up games
  • 通勤與碎片時間的益智娛樂Smart and lightweight game for commute time

 常見稱呼
Common Names

  • 猜數字Guess the Number
  • 幾A幾B 遊戲Bulls and Cows
  • 推理遊戲Logic Deduction Game
  • 數字解謎Number Puzzle Game
  • 邏輯練習工具Logic Training Tool

 常見問題
Frequently Asked Questions

「幾A幾B」各代表什麼意思?

A(Bull)代表:數字正確,且位置也正確。B(Cow)代表:數字正確,但位置錯誤。例如答案是 1234,猜 1357 → 結果是 1A1B:「1」正確且在第一位(1A);「3」正確但在第三位而非第二位(1B)。目標是推理出 4A0B。

A (Bull) = correct digit in the correct position. B (Cow) = correct digit but wrong position. Example: answer is 1234, guess 1357 → result is 1A1B: "1" is correct and in position 1 (1A); "3" is correct but in position 3 instead of 2 (1B). The goal is 4A0B.

最少幾次可以猜出答案?

理論上最優策略可在 5 次之內猜出任何 4 位不重複數字的答案(資訊論最優解)。一般玩家通常需要 6–8 次。透過「顯示可能組合」功能,您可以看到每次猜測後剩餘的候選答案,有助縮短猜測次數。

Theoretically, an optimal strategy can solve any 4-digit non-repeating answer in 5 guesses or fewer (information-theory optimal). Most players take 6–8 guesses. Use the "Show Possibilities" feature to see remaining candidates after each guess and narrow down faster.

開局第一次應該猜什麼?

好的開局猜測應該覆蓋多種可能性。研究顯示選擇數字分散(如 1234 或 0123)的組合作為首猜,可以最快獲得有效資訊。更進階的策略是使用「最大資訊量」的猜測(如 1234 或 1357),每次最小化剩餘可能組合數。

A good opening guess maximizes information. Research shows starting with digits spread across ranges (e.g., 1234 or 0123) provides effective initial feedback. Advanced players use "maximum entropy" guesses (like 1234 or 1357) to minimize remaining possibilities after each step.

「顯示可能組合」功能如何運作?

點擊後,系統依據您的所有歷史猜測與回饋,過濾出目前仍符合所有條件的候選答案清單。例如若已知「1」不在答案中(0A0B),所有含「1」的組合都會被排除。這個功能讓您能像電腦一樣系統性地縮小答案範圍。

After clicking, the system filters all possible answers that are consistent with every guess and result so far. For example, if "1" got 0A0B, all combinations containing "1" are eliminated. This feature lets you systematically narrow the solution space like a computer algorithm.

數字可以重複嗎(如 1122)?

不可以。本遊戲採用「4 位不重複數字」規則,答案由 0–9 中 4 個不同的數字組成(共有 10×9×8×7 = 5040 種可能組合)。玩家輸入的猜測也必須是 4 位不重複數字,重複的輸入會被提示錯誤。

No. This game uses non-repeating 4-digit rules — the answer consists of 4 different digits from 0–9 (5,040 possible combinations: 10×9×8×7). Player guesses must also be 4 unique digits; repeated digits will be flagged as invalid input.

這個遊戲和 Wordle 有什麼關係?

Wordle 的機制正是源自猜數字(Bulls and Cows)!兩者的核心邏輯相同:猜測後收到「正確位置(A/綠色)」和「正確但位置錯誤(B/黃色)」的回饋,逐步推理出答案。Wordle 將數字換成字母、從 4 位換成 5 個字母,並加入視覺化鍵盤,將這個古老的紙筆遊戲帶回了大眾視野。

Wordle is directly inspired by Bulls and Cows! Both share the same core mechanic: guesses receive "correct position" (A/green) and "correct but misplaced" (B/yellow) feedback to deduce the answer. Wordle swapped digits for letters, extended to 5 characters, and added a visual keyboard — bringing this classic paper-and-pencil game back to the mainstream.

 總結
Summary

猜數字是一款融合邏輯推理、數字思維與記憶力的遊戲,不僅適合休閒放鬆,也能作為邏輯訓練工具。簡潔的操作介面與回饋設計,讓人樂在其中。

This game blends logic, numbers, and memory into a fun and stimulating experience. With a clean interface and structured feedback, it’s perfect for both casual play and focused training.