179Games · Turn-based games

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
01

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
1, −1, 0, 42, 3
Standard solution (without a calculator)
  1. Apply the stated rules in order.
  2. 25<42 ⇒ 1; 60>42 ⇒ −1; 42=42 ⇒ 0
  3. C=3; X=42
  4. Output sequence: 1, −1, 0, 42, 3
Do it on the calculator

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
−9, 0, 42, 1
Standard solution (without a calculator)
  1. Apply the stated rules in order.
  2. 101>100 ⇒ −9; C=0
  3. 42=42 ⇒ 0; C=1
  4. Output sequence: −9, 0, 42, 1
Do it on the calculator

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
1, 42, 1
Standard solution (without a calculator)
  1. Apply the stated rules in order.
  2. ∅: Leave the input blank and press EXE.
  3. 35<42 ⇒ 1; C=1
  4. A=0 ⇒ X=42; C=1
  5. Output sequence: 1, 42, 1
Do it on the calculator
02

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.

Sign in to unlock the full programme

Checking access…

The programme code and appendix unlock together.

Checking access…

Sign in to unlock the full programme

Checking access…

The programme code and appendix unlock together.