Guess the Number
Guess the Number
Find a hidden integer from 1 to 100 using higher/lower hints. Only valid guesses increase the count.
- 111 bytes
- COMP mode
Worked examples
Example 1
Original game exercise. Assumed secret: X=42. Input order: 25 → 60 → 42. Read the output sequence and explain the result. These examples assume the stated draws solely to explain a game. Ordinary play is random and will usually show different values; these inputs do not force the illustrated secret or cards.
Answer
Standard solution (without a calculator)
- Apply the stated rules in order.
- 25<42 ⇒ 1; 60>42 ⇒ −1; 42=42 ⇒ 0
- C=3; X=42
- Output sequence: 1, −1, 0, 42, 3
Example 2
Original game exercise. Assumed secret: X=42. Input order: 101 → 42. Read the output sequence and explain the result. These examples assume the stated draws solely to explain a game. Ordinary play is random and will usually show different values; these inputs do not force the illustrated secret or cards.
Answer
Standard solution (without a calculator)
- Apply the stated rules in order.
- 101>100 ⇒ −9; C=0
- 42=42 ⇒ 0; C=1
- Output sequence: −9, 0, 42, 1
Example 3
Original game exercise. Assumed secret: X=42. Input order: 35 → ∅. Read the output sequence and explain the result. These examples assume the stated draws solely to explain a game. Ordinary play is random and will usually show different values; these inputs do not force the illustrated secret or cards.
Answer
Standard solution (without a calculator)
- Apply the stated rules in order.
- ∅: Leave the input blank and press EXE.
- 35<42 ⇒ 1; C=1
- A=0 ⇒ X=42; C=1
- Output sequence: 1, 42, 1
When to use it
Find a hidden integer from 1 to 100 using higher/lower hints. Only valid guesses increase the count. These examples assume the stated draws solely to explain a game. Ordinary play is random and will usually show different values; these inputs do not force the illustrated secret or cards.
Input order
- A?: an integer 1–100; 0 or blank EXE gives up.
Output order
- 1 means too small, −1 too large, 0 correct; then the secret and valid-guess count. Giving up omits the correct-guess 0. Invalid input gives −9 without counting.
Conditions and limitations
- The secret remains unchanged after errors. Each legal guess, including the correct one, counts once.
- The program sets Fix 0, overwrites its registers and Ans, then returns to Norm 1 on normal completion. AC during play may leave Fix 0. Previous values and display settings are not restored. Registers can be inspected; there is no anti-cheating protection.
- Equal-likelihood claims assume independent equally likely Ran# grid values; no cryptographic security is claimed. When used, rejection sampling has no fixed maximum number of draws.
Checking access…