# Efail: the deterministic game engine built for AI agents > Efail is a deterministic 2D and low-poly 3D game engine built for AI agents, written in Bend. A game is one file of pure functions. The engine handles the window, the clock, input, replays, screenshots and headless runs, so an agent only writes the game and checks it as text and PNGs. *Efail* is Welsh for "smithy" and is said EV-ile. It is at v0, runs on Linux (X11 or XWayland) and is MIT licensed. - Full 2D guide (the page an agent needs to write a game): https://efail-site-production.up.railway.app/docs/2d.md - Full 3D guide: https://efail-site-production.up.railway.app/docs/3d.md - Everything in one file: https://efail-site-production.up.railway.app/llms-full.txt - Source: https://github.com/typenx/efail (temporarily private while the next version is built; it will be back) ## Why an engine for agents Agents making games spend most of their effort on the layer around the game: choosing a stack, wiring a renderer and input, building ways to see and test what they made, and fighting an editor GUI. Efail makes those choices up front. - **One file of pure functions.** A game is `game.bend`: `init`, `step`, `draw` (or `scene` in 3D) and `show`. No game loop, renderer or input code. - **Headless and deterministic.** `efail sim` runs any number of ticks with scripted keys in milliseconds and prints the state. The same seed and keys always give the same states and pixels. - **Agents can see the game.** `efail shot` saves any frame as a PNG; `efail film` saves a labelled grid of frames in one PNG. - **Human bugs replay exactly.** `efail run` records what the player did; `efail replay` reruns it headless. - **Proven rules.** Through Bend's laws, a game states facts like "game over waits for Space" and `efail check` proves them. - **One page of docs per mode.** AGENTS.md covers 2D, AGENTS3D.md covers 3D. ## The contract ```python import Base import ./efail/efail.bend as E type State is Data: # your state ... def init(seed: U32) -> State: # the first state def step(+input: E.Input, s: State) -> State: # one tick; 60 a second def draw(s: State) -> List: # what to show, back to front def show(s: State) -> String: # one line for efail sim ``` All functions are pure: no IO, no time, no randomness except what is derived from the seed. ## Commands | Command | What it does | Output | | --- | --- | --- | | `efail check` | Type-checks the game, checks the contract, proves its laws | Errors as text | | `efail sim --ticks 300 --every 60` | Runs headless with scripted input | One `show(state)` line per sampled tick, plus each sound | | `efail shot --ticks 120` | Runs, then saves one frame | `build/shot.png` | | `efail film --ticks 120 --every 10` | Frames every N ticks in one image | `build/film.png`, each frame labelled with its tick | | `efail run` | A human plays in a window (Esc quits) | `build/last.replay` | | `efail replay --every 30` | Reruns what the human just did, headless | State lines | | `efail web` | Builds the game as one self-contained web page | `build/game.html` | 3D games use `efail3d` with the same subcommands (`new`, `check`, `sim`, `shot`, `run`, `replay`, `bench`). Example `efail sim` output from the Dodge example with no keys pressed: ``` tick 0: play x=150 blocks=0 score=0 tick 60: play x=150 blocks=2 score=60 tick 120: play x=150 blocks=4 score=120 tick 141: sound slide 440>60 400ms square tick 141: sound beep 90 250ms noise tick 180: over score=142 best=142 ``` Input scripts and recorded replays share one plain-text format: ``` seed 42 # optional 0 # nothing held at tick 0 30 right # right held from tick 30 90 right space # space also goes down at tick 90 120 # all keys up 150 @100,60 # move the mouse pointer 160 mouse_left # click end 300 ``` ## Laws ```python # LAW: the game-over screen waits for Space. law over_waits: for +input: E.Input for score: U32 for seed: U32 for best: U32 {E.pressed(input, E.space()) == False{} : Bool} -> {Game.step(input, Game.Over{score, seed, best}) == Game.Over{score, seed, best} : Game.State} ``` `efail check` proves each law for every possible input. ## 2D and 3D - **2D:** rectangles, circles, a built-in 3x5 pixel font, sprites written as text, keyboard and mouse input, seeded random, collision helpers, retro sound described as data, and export to a single web page. - **3D (low-poly):** colored triangle rendering, depth, clipping, transformed primitive meshes, flat lighting, cameras, deterministic gravity, box and sphere collision, raycasts, screenshots and exact replay. Textures, imported models, skeletal animation, shadows and rigid-body joints are outside the first 3D release. ## How an AI agent builds a game with Efail Efail works with any coding agent that can run shell commands and read text files and images, including Claude Code and Codex. There is no plugin, MCP server or editor integration to set up. 1. **Read one page.** `AGENTS.md` holds the whole 2D contract, API, input-file format and the Bend rules that matter. 2. **Write the game.** Edit `game.bend`: a state type and the pure functions `init`, `step`, `draw` and `show`. 3. **Check it.** `efail check` type-checks the file, checks the contract and proves any laws. 4. **Play it without a screen.** Write an input script, run `efail sim`, read the state line by line. 5. **Look at it.** `efail shot` saves a frame; `efail film` saves a strip of frames as one PNG. 6. **Hand it to a person.** `efail run` records the session; `efail replay` reproduces any bug exactly. 7. **Share it.** `efail web` turns a 2D game into one HTML file. ## Efail compared with editor-based game engines Engines such as Unity, Godot and Unreal are built around a visual editor and aim at large commercial games. Efail is not trying to replace them. It is a small, code-only engine for games an AI agent can write and verify on its own. | | Editor-based engine | Efail | | --- | --- | --- | | Making a game | Scenes, assets and settings arranged in a visual editor | One text file of pure functions | | Testing it | Usually a person plays it in a window | A command prints the state as text or saves a PNG, with no display needed | | Reproducing a bug | Follow written steps and hope it happens again | Replay the recorded input: the same ticks, states and pixels | | Same input, same result | Often depends on frame timing and the machine | Always, by design | | Checking the rules | Tests that try some cases | Laws proven for every input | | What to read first | A large manual and editor tutorials | One page per mode | | Best suited to | Large 2D and 3D games made by teams | Small 2D games and low-poly 3D games made by agents | ## Terms - **Agent-native game engine:** an engine designed for an AI agent as its main user; every feature is driven from the command line and checked as text or an image. - **Deterministic:** the same seed and input produce the same states and pixels on every run. - **Headless:** running without a window or display. - **Replay:** a plain-text record of which keys were held on which tick; an exact reproduction of a play session. - **Law:** a fact about a game's rules, written in Bend and proven by `efail check`. - **Tick:** one call to `step`; Efail runs 60 ticks a second. ## Quick start Note: the source repository is temporarily private while the next version is built. These steps apply once it is back. ```sh curl -fsSL https://bend-lang.com/install.sh | sh # Bend 2 (needs clang) git clone https://github.com/typenx/efail && cd efail export PATH="$PWD/bin:$PATH" efail new mygame && cd mygame efail check efail sim --ticks 300 --every 60 # headless, state as text efail shot --ticks 120 # build/shot.png efail run # play (Esc quits) ``` Then read `AGENTS.md` in the game folder (the same text as https://efail-site-production.up.railway.app/docs/2d.md) and edit `game.bend`. For 3D: ```sh efail3d new my3dgame && cd my3dgame efail3d check efail3d sim --ticks 300 --every 60 efail3d shot --ticks 120 ``` ## FAQ **What is Efail?** A deterministic 2D and low-poly 3D game engine built for AI agents, written in Bend. A game is one file, `game.bend`, made of pure functions. **Why is it a good engine for AI coding agents?** Everything an agent needs to check is text or a PNG, every run is deterministic, there is no editor GUI, and the whole 2D API fits in one page of docs. **How does an agent test a game without a screen?** It writes a plain-text input file, then runs `efail sim` (state as text), `efail shot` (one PNG) or `efail film` (a labelled grid of frames). **Can Claude Code or Codex make a game with Efail?** Yes. Any coding agent that can run shell commands and read text files and images can. No plugin or MCP server is needed. **What is a deterministic game engine?** One that gives exactly the same result every time it runs with the same seed and input. In Efail that covers the state and the pixels. **What is a headless game engine?** One that can run a game without a window or display. Efail simulates with `efail sim` and renders with `efail shot` and `efail film`. **How is Efail different from Unity, Godot or Unreal?** Those are built around a visual editor and aim at large commercial games. Efail has no editor, every check is a command with text or PNG output, and every run is deterministic. It aims at small 2D and low-poly 3D games an agent can write and verify alone. **Is Efail an AI game generator?** No. It generates nothing and contains no AI model. It is the engine an AI coding agent writes a game for. **What kinds of games can you make?** Small 2D games (arcade, puzzle, platform, mouse-driven) with shapes, a pixel font, text-art sprites and retro sound, and low-poly 3D games with cameras, flat lighting and basic physics. **What language are games written in?** Bend, a Python-shaped, strictly typed functional language. The engine is written in Bend too. **Does it support 3D?** Yes, low-poly 3D through `efail3d`. **Can games run in a browser?** Yes, for 2D: `efail web` writes one self-contained `build/game.html`. A playable example is at https://efail-site-production.up.railway.app/play/dodge.html. **What platforms?** Linux (X11 or XWayland) at v0. Headless commands need no display. **Is it free?** Yes, MIT licensed. --- # Efail: making a game (read this first) Efail is a 2D game engine written in [Bend](https://github.com/bendlang/bend). A game is one file, `game.bend`, with pure functions. Efail handles the window, the clock, input, replays, screenshots and headless runs. You never write a game loop, a renderer or input handling. ## The loop you work in ```sh efail check # type-check (do this after every edit) efail sim --ticks 300 --every 60 # run headless, print show(state) efail shot --ticks 120 --input keys.txt # run, then save build/shot.png; look at it efail film --ticks 120 --every 10 # frames every 10 ticks in one build/film.png efail run # a human plays; Esc quits efail replay --every 30 # rerun exactly what the human just did efail web # build/game.html: the game in one web page ``` Everything is deterministic. The same seed and the same input give the same states and the same pixels on every run. To reproduce a bug a human hit, run `efail replay`. To check that a change works, write an input file, run `efail sim` or `efail shot`, and read the output or open the PNG. For anything that moves or animates, `efail film` is the one image to open: a grid of frames, each labelled with its tick (`T 40`), matching the tick lines it prints. ## The contract: what game.bend defines ```python import Base import ./efail/efail.bend as E def title() -> String: # window title def width() -> U32: # pixels def height() -> U32: def background() -> U32: # a color type State is Data: # your state; it must be `is Data` ... def init(seed: U32) -> State: # the first state def step(+input: E.Input, s: State) -> State: # one tick; 60 a second def draw(s: State) -> List: # what to show, back to front def show(s: State) -> String: # one line for efail sim # optional: the sounds that start this tick, from the state before and after def sounds(old: State, now: State) -> List: ``` The parameter quantities must match exactly: `+input` in `step`, and plain `s`, `old`, `now` everywhere (destructure a state once to reuse its fields). All the functions are pure: no IO, no time, no randomness except what you derive from the seed. `efail check` checks this contract too. ## API (`E.` is efail/efail.bend) **Shapes** (coordinates are F32 pixels from the top left; partly or fully off the screen is fine): - `E.rect(x, y, w, h, color) -> E.Shape` - `E.circle(cx, cy, r, color) -> E.Shape` - `E.text(string, x, y, size, color) -> List`: a 3x5 pixel font, `size` pixels per cell, so a glyph is 3·size wide and 5·size tall, spaced every 4·size. It has A–Z (lowercase is drawn as uppercase), 0–9, and `: . , - + ! ? / ( ) = % ' < > _ # *`. - `E.text_width(string, size) -> F32`: use it to center text. **Sprites** are pixel art written as text, one character per pixel: ```python def ship() -> List<&2, String>: ["..w..", ".wbw.", "wwwww"] def inks() -> List<&2, E.Ink>: [E.ink('w', E.white()), E.ink('b', E.blue())] # in draw: E.sprite(ship(), inks(), x, y, 4.0) # 4 pixels per character ``` - `.` and space are transparent. A character with no ink draws **magenta**: if a shot shows magenta, add the ink. - `E.flip(rows)` mirrors a sprite left to right. `E.frame([a(), b()], tick, 8)` picks an animation frame, switching every 8 ticks. - `E.sprite_w(rows, scale)` and `E.sprite_h(rows, scale)` give the size, for `E.overlap`. - Keep every row the same length. `examples/sprites` shows all of this. Join lists with `a <> b` (one shape in front of a list), `List.append(&1, E.Shape, xs, ys)` or `List.concat(&1, E.Shape, [xs, ys, zs])`. **Colors** are U32 `0xRRGGBB` values. Bend has no hex literals, so use `E.rgb(r, g, b)` or a named color: `E.black() white() gray() red() orange() yellow() green() blue() purple() pink() navy()`. **Input** (`input: E.Input`): - `E.move_x(input) -> F32` and `E.move_y(input) -> F32`: -1.0, 0.0 or 1.0 from the arrows **or** WASD (x: left/right, y: up/down, where down is +). Use these for movement: players reach for either. - `E.held(input, key) -> Bool`: the key is down this tick. - `E.pressed(input, key) -> Bool`: the key went down this tick (it was up the tick before). A tap, however short, is held for at least one tick. - `E.axis(input, neg_key, pos_key) -> F32`: -1.0, 0.0 or 1.0 from two keys you choose. - `E.tick(input) -> U32`: the tick number. - Mouse: `E.mouse_x(input)`, `E.mouse_y(input)` (F32 game pixels, whole numbers), `E.clicked(input)` (the left button went down this tick) and `E.mouse_held(input)`. The buttons are keys too: `E.mouse_left()`, `E.mouse_right()`, for `E.held`/`E.pressed`. Test a click on something with `E.inside(E.mouse_x(input), E.mouse_y(input), x, y, w, h)`. - Keys: `E.left() right() up() down() space() enter() escape() tab() shift()`, and `E.key('w')` for a letter or digit. Esc always quits `efail run`. **Random:** keep a `seed: U32` in your state. `E.rand(seed)` returns a random U32, which is also your next seed. `E.rand_range(r, lo, hi) -> U32` gives a number in [lo, hi), and `E.randf(r) -> F32` one in [0, 1). **Collisions** (rects are `x, y, w, h` from the top left, circles `cx, cy, r`; touching edges don't count): - `E.overlap(ax, ay, aw, ah, bx, by, bw, bh) -> Bool`: two rects. - `E.inside(px, py, x, y, w, h) -> Bool`: a point in a rect. - `E.circles_meet(ax, ay, ar, bx, by, br)`, `E.circle_rect(cx, cy, r, x, y, w, h)`, and `E.dist(ax, ay, bx, by) -> F32`. **Math and choices are in Base already:** `F32.min max clamp lerp hypot abs sqrt sin cos atan2 floor`, `F32.pi()`, `U32.min max clamp`. `Bool.pick(T, c, a, b)` is a one-line "if" for any type (`a` when `c` is True), and `E.only(c, shapes)` draws shapes only when `c` is True. **Sound:** retro tones, described as data. You can't hear them; you check them in text. `efail sim` prints each sound on the tick it starts: `tick 141: sound slide 440>60 400ms square`. - `E.beep(freq, ms, wave)`: a tone (`880.0` Hz for `60` ms). `E.slide(from, to, ms, wave)`: a sliding pitch (jumps rise, falls drop). - Waves: `E.square()` (classic blip), `E.sine()` (soft), `E.saw()` (buzzy), `E.noise()` (hits, explosions; freq sets its grain). - `E.when(cond, sound) -> List`: the sound or nothing. Join several with `List.append(&1, E.Sound, a, b)`. - In `sounds(old, now)`, compare the two states: score went up, a life was lost, a state changed (`match old now:` with a case per pair). - `efail sim --wav out.wav` also writes the audio (16-bit, 24 kHz) for a human; the text lines are what you check. `efail run` plays the sounds (and plays silently, saying so, where there is no audio device). ## The web page (`efail web`) `efail web` writes `build/game.html`, one self-contained file that plays the game in a browser (open it as a file, or put it on any static host). It runs your own `init`/`step`/`draw`/`show`/`sounds`, compiled to JavaScript by Bend, with the native rules: 60 ticks a second, the same keys and mouse, the same pixels and sounds. Its "Save replay" button downloads `last.replay`. `efail sim --input last.replay` reruns that play exactly, so a bug a person hits in the browser is reproduced headless like any other replay. Nothing in game.bend changes for the web. ## Input files (and replays) Plain text with one line per change: a tick, then the keys held from that tick on. `efail run` writes the same format to `build/last.replay`. ``` # comments start with # seed 42 # optional: the seed (--seed wins) 0 # nothing held at tick 0 30 right # right held from tick 30 90 right space # space also goes down at tick 90 (so pressed() is true then) 120 # all keys up 150 @100,60 # move the mouse pointer to (100, 60); it stays until the next @ 160 mouse_left # left button down at tick 160 (clicked() is true then) 165 # button up end 300 # optional: how many ticks (--ticks wins) ``` Key names: `left right up down space enter escape tab shift mouse_left mouse_right`, a single letter or digit, or a raw key code. `@x,y` (whole pixels, no spaces) moves the pointer. Recorded replays use the same words. A replay belongs to the game version that recorded it: change the controls or the rules, and an old replay plays out differently. Keep the input files your checks depend on next to the game and rerun them after each change. ## Writing Bend: the rules that bite Bend is Python-shaped but strict. Read `bend guide` once; these are the rules you will run into: 1. **A def must come before every use** in the file, types included. Put helpers above their callers. 2. **No mutual recursion, and recursion must shrink something.** A recursive call takes a smaller piece from a `match` (a list's tail, `n` from `1n+n`). For a loop of N steps, count down a `Nat`. 3. **There is no `if`.** Write a helper that matches on a `Bool` parameter: ```python def pickf(c: Bool, a: F32, b: F32) -> F32: match c: case True{}: a case False{}: b ``` For values, `Bool.pick(T, c, a, b)` does this for any type (and `E.pick` for U32, `E.pickf` for F32). A match is still needed when the branches do different work, such as recursion or building different states. 4. **`match` and destructuring work only on parameters or pattern fields,** never on a computed value. Pass the value to a helper that takes it as a parameter. A `let` may not come before a `match` on a parameter. 5. **Variables are used at most once,** unless marked `+`: `+x = ...`, `+x: T` in a parameter list, or `Con{+h, t}` in a pattern. Mark a value `+` when you need it twice. A Nat predecessor you reuse is `1n+(+k)`. 6. **Operators need a type and spaces:** `(a + b * 2.0 : F32)` and `(n > 3 : U32)`. Equality is a call: `U32.is_eq(a, b)`. `&&` and `||` work on Bool; `++` joins Strings. 7. **Literals:** `3` is U32, `3.0` is F32, `3n` is Nat. There are no negative literals, so write `(0.0 - 3.0 : F32)`. There are no hex literals. Conversions: `U32.to_f32`, `F32.to_u32`, `U32.show`, `Nat.show`. 8. **A list of shapes is `List`. A list inside your State is `List<&2, T>`,** because State is `is Data` and its fields must be copyable. 9. When the checker can't tell a type, annotate it: `{x : U32}`. `bend base` prints the standard library. `bend base List` prints one part. ## Laws (optional, Bend's superpower) Add `LAWS.bend` to state facts that must always hold, for example "Esc quits", "the score never drops" or "a game over stays over until space". Prove them in `PROOF.bend`; `efail check` then proves them. See `bend guide` (Laws and Proofs). Write laws about your step logic, not about F32 math: F32 can't be proven. ## Files ``` game.bend your game (edit this) efail/efail.bend the engine's API, a copy (`efail upgrade` refreshes it); every E.* name is here with its doc comment: read it if unsure efail/lib/ the engine's parts (rendering, PNG, sound, ...); no need to read build/ made by efail; safe to delete AGENTS.md this file ``` --- # Efail 3D: making a game Efail 3D is a deterministic low-poly 3D game engine written in Bend. A game is one `game.bend` file of pure functions. The engine owns the loop, renderer, input, screenshots, simulation, replays, and basic physics. ## The workflow ```sh efail3d check efail3d sim --ticks 300 --every 60 efail3d shot --ticks 120 # build/shot.png efail3d run # Esc quits and records a replay efail3d replay --every 30 efail3d bench --input keys.txt # render every scripted frame ``` Input scripts and replay files use the same format documented in the included 2D engine guide: a tick followed by held keys, plus an optional seed and end. ## The game contract ```python import Base import ./efail/efail.bend as E import ./efail/efail3d.bend as E3 def title() -> String def width() -> U32 def height() -> U32 type State is Data: ... def init(seed: U32) -> State def step(+input: E.Input, state: State) -> State def scene(state: State) -> E3.Scene def show(state: State) -> String ``` `step` runs at a fixed 60 ticks per second. `scene` describes the current picture. `show` returns the one-line state used by headless simulation. ## Coordinates - X points right, Y points up, and Z points forward. - A camera with zero rotation looks along positive Z. - Positions, sizes, velocities, and angles are `F32`; angles use radians. - Screen coordinates begin at the top left, so projection flips Y. - Raw triangle vertices use clockwise winding when viewed from the visible side. Built-in meshes already have the correct winding. ## Vectors and transforms ```python E3.vec3(x, y, z) E3.Vec3.zero() E3.Vec3.add(a, b) E3.Vec3.sub(a, b) E3.Vec3.scale(v, factor) E3.Vec3.dot(a, b) E3.Vec3.cross(a, b) E3.Vec3.length(v) E3.Vec3.normalize(v) E3.Vec3.rotate_x(v, angle) # also rotate_y and rotate_z E3.transform(position, rotation, scale) E3.Transform.at(position) E3.Transform.identity() ``` Rotation order is X, then Y, then Z. ## Cameras ```python E3.camera(position, yaw, pitch, fov, near) E3.Camera.look_at(position, target, fov, near) E3.Camera.move(camera, right, up, forward) E3.Camera.turn(camera, yaw_by, pitch_by) E3.Camera.with_fov(camera, fov) E3.Camera.forward(camera) E3.Camera.right(camera) E3.Camera.select(first, a, b) ``` The ready-made deterministic controls are: ```python E3.Camera.controls(input, camera, move_speed, turn_speed) ``` WASD moves, Space/Shift rises and falls, and the arrow keys turn. Speeds are units and radians per fixed tick. ## Scenes, objects, and lighting ```python E3.Mesh.cube(size, color) E3.Mesh.quad(size, color) E3.Mesh.plane(size, color) E3.mesh(triangles) E3.object(mesh, transform) E3.directional(direction, ambient) E3.scene(camera, objects, light, background) ``` Example: ```python def scene(state: State) -> E3.Scene: State{camera, angle} = state E3.scene(camera, [ E3.object(E3.Mesh.cube(2.0, E.orange()), E3.transform(E3.vec3(0.0, 0.0, 5.0), E3.vec3(0.0, angle, 0.0), E3.vec3(1.0, 1.0, 1.0))), E3.object(E3.Mesh.plane(12.0, E.gray()), E3.Transform.at(E3.vec3(0.0, (0.0 - 1.0 : F32), 5.0))) ], E3.directional(E3.vec3(0.3, 0.8, 1.0), 0.25), E.navy()) ``` Lighting is flat directional light plus an ambient minimum. Colors use the 2D engine's `E.rgb` and named colors. ## Basic physics Physics is deterministic and fixed-tick. Bodies have a center position, velocity, collider, and grounded flag. ```python E3.box_collider(half_size) E3.sphere_collider(radius) E3.body(position, velocity, collider) E3.static_body(position, collider) E3.Body.step(moving_body, static_bodies, gravity_per_tick) E3.Body.overlaps(a, b) E3.Body.position(body) E3.Body.velocity(body) E3.Body.grounded(body) E3.Body.with_velocity(body, velocity) E3.physics(moving_bodies, static_bodies, gravity) E3.Physics.step(world) E3.raycast(origin, direction, bodies) ``` `Body.step` applies gravity, then resolves X, Y, and Z movement against static box or sphere bodies. A downward collision sets `grounded` and clears vertical velocity. Raycasts return `E3.RayMiss{}` or `E3.RayHit{distance, point}`. This is intentionally basic gameplay physics: no joints, rotation dynamics, soft bodies, or triangle-mesh colliders. ## Input Use the core engine API: ```python E.held(input, key) E.pressed(input, key) E.axis(input, negative_key, positive_key) E.tick(input) E.mouse_x(input) E.mouse_y(input) ``` Keys include `E.left()`, `right()`, `up()`, `down()`, `space()`, `enter()`, `shift()`, and `E.key('w')`. Input is recorded and replayed exactly. ## What the renderer handles The engine transforms, lights, clips, projects, culls, bins, and depth-tests triangles. Geometry crossing the near plane is clipped. Backfaces and off-screen regions are removed. Triangle list order does not affect depth. The MVP renders flat colors. It does not yet include textures, model importing, shadows, skeletal animation, advanced materials, or a visual editor. ## Bend rules that matter - Every def must appear before it is used. - There is no `if`; match a `Bool` parameter in a helper. - Match and destructure parameters or pattern fields, not computed values. - Mark reused values with `+`. - Operators need spaces and a type annotation: `(a + b : F32)`. - There are no negative literals: `(0.0 - 1.0 : F32)`. - State lists use `List<&2, T>` so the state remains `Data`. - Keep all game logic pure. Randomness comes from a seed carried in State. Run `efail3d check` after every edit. Use `sim` to inspect state and `shot` to inspect pixels before trying the game interactively.