<!-- canonical: efficientnewlanguage.org/ai/examples/006-mvp-number-guessing-game | ai_layer_version: 0.1.0 | updated: 2026-07-18 -->

# Example 006 — MVP proof: a second real, recognizable program ported to EML

`number_guessing_game.eml` is the second "does EML actually work for something real" test (see [`examples/mvp-tic-tac-toe/`](../mvp-tic-tac-toe/) for the first) — a genuine, independently-authored small program expressed end to end in EML: transpiled to Python, executed, and verified against real Python via the interpreter equivalence gate.

## EML

```eml
# Ported from Python-World/python-mini-projects (projects/Number_guessing_game,
# MIT-licensed) — a second real, independently-authored program proof for EML
# (see examples/mvp-tic-tac-toe/ for the first). The original draws the secret
# number from random.randint() and reads guesses via input(); this port fixes
# both to a deterministic scripted sequence (a mix of too-low and too-high
# guesses before the correct one) so the whole program is verifiable
# byte-for-byte against real Python (see number_guessing_game.trace.jsonl,
# generated by `eml trace --run`).
secret^+7
guesses^+[3, 8, 5, 6, 7]
chances^+0
message^+""

for guess in guesses:
    if guess == secret:
        "CONGRATULATIONS! YOU HAVE GUESSED THE NUMBER " + str(secret) + " IN " + str(chances) + " ATTEMPTS!" => message
        message^0
        break
    elif guess < secret:
        "Your guess was too low: Guess a number higher than " + str(guess) => message
    else:
        "Your guess was too high: Guess a number lower than " + str(guess) => message
    message^0
    chances^+1

chances^0
```

## Python (deterministic transpilation)

```python
secret = 7
guesses = [3, 8, 5, 6, 7]
chances = 0
message = ""
for guess in guesses:
    if guess == secret:
        message = "CONGRATULATIONS! YOU HAVE GUESSED THE NUMBER " + str(secret) + " IN " + str(chances) + " ATTEMPTS!"
        print(message)
        break
    elif guess < secret:
        message = "Your guess was too low: Guess a number higher than " + str(guess)
    else:
        message = "Your guess was too high: Guess a number lower than " + str(guess)
    print(message)
    chances += 1
print(chances)
```

## stdout (executed)

```text
Your guess was too low: Guess a number higher than 3
Your guess was too high: Guess a number lower than 8
Your guess was too low: Guess a number higher than 5
Your guess was too low: Guess a number higher than 6
CONGRATULATIONS! YOU HAVE GUESSED THE NUMBER 7 IN 4 ATTEMPTS!
4
```

## Round-trip

`ok: true` — round-trip fixpoint reached (python1 == python2)

## Trace event types

eml:run:start · eml:assign · eml:output · eml:augment · eml:run:done
