Skip to content

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

19 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

awesome-crush

A collection of self-playing ASCII games written in Crush, each authored by a different LLM given the same minimal prompt — "can you learn crush?", pointed at crush-ast, nothing else — with the freedom to explore, propose what to build, and build it. One entry (game_of_life.crush) is hand-written by Claude directly rather than dispatched, as a fourth point of comparison.

Why this exists

This started as a real-world comparison test: three different models (one external base model, one external base model's own fine-tune, one different architecture entirely) hit the same unfamiliar, still-evolving language with zero task spec, and each produced a working, self-playing game. Rather than let those artifacts scatter across crush-ast's own examples/ directory (where they now also live), this repo collects them side by side with the story of how each was built.

The games

games/v2/ is the current-toolchain set: game_of_life and tictactoe rewritten as real CLIs on facet 0.3.0 (options, seeds, count flags, option groups), with structs, arrays and golden-output tests. See games/v2/README.md. The tables below keep the original single-file games unchanged.

Game Author State encoding Notes
games/pong.crush Ornith-1.5-35B-A3B (MoE) Many scalar args threaded through recursion v1→v2 iteration: found and self-fixed two real rendering bugs (a ball-on-column-priority bug that hid whatever wall/paddle/center-line shared its column)
games/tictactoe.crush foreman-v2 (Qwen3.8-27B fine-tune) Board as a single base-3 integer Clean on first try; found the trailing-return codegen bug via the repo's own dejavue memory and cited it
games/lights_out.crush qwen38-base (base Qwen3.8-27B) Board as a 25-bit bitfield integer Clean on first try; extended tictactoe's integer-encoding trick to a bitfield; the only one of the three dispatched models that proactively ran the full project conformance suite (874 tests) before declaring done
games/game_of_life.crush Claude (hand-written, not dispatched) Board as a 25-bit bitfield integer Conway's Game of Life — a different category entirely (cellular automaton, not a 2-player game or a scramble-and-solve puzzle); genuinely used the manifest-level AI-native annotations (@module/@decision/@invariant) and found a real compiler bug doing so — see below
games/blackjack.crush OpenCode Scalar hand totals and deck position A pure-Crush card game: deterministic 52-card permutation, soft-ace scoring, recursive hit/stand play, dealer resolution, and bankroll across six rounds
games/pong-deepseek.crush cece / bro (DeepSeek-v4) Many scalar args threaded through recursion A second, independent take on Pong (distinct from Ornith's) — two self-playing paddles with an LCG-driven hesitation model; also merged into crush-ast's own examples/crush/
games/fifteen_puzzle.crush bro (DeepSeek-v4) 15 tiles packed as base-16 nibbles in one i64, blank as a separate scalar From the captain's own separate bro session (not one of this repo's dispatches) — that session finished the code but hung before it could commit; recovered and verified here. The most algorithmically sophisticated entry: real IDA* (iterative-deepening A*) with a Manhattan-distance heuristic, seeded-LCG scramble, packed move-path replay. Verified solving a 30-move scramble optimally in 6 moves — matching the initial heuristic estimate exactly
games/breakout.crush cece (DeepSeek-v4) 30 bricks as one bit each in a single integer Classic brick-breaker — AI paddle tracks the ball's x-position, angle changes based on paddle-hit offset. Same bitfield-in-an-integer trick as lights_out/game_of_life. Verified: runs to completion, score tracks the brick count exactly (140 = 14 bricks × 10)
games/rps_tournament.crush bro (Muse) Bot strategies as pure functions; scores as scalars threaded through calls Rock-Paper-Scissors bot tournament: three deterministic bots (always-rock, cycler, copycat) round-robin, 5 rounds/match; ASCII standings bar chart + trophy. Compiled first try; results hand-verified (Cycler champion, 14 pts)

All nine are self-playing (no interactive input — Crush currently has no keyboard/stdin), and all nine run to a deterministic, verifiable conclusion. The original eight thread their entire game state through recursion-as-arguments rather than mutable arrays (a real language constraint, not a stylistic choice — see below); the RPS tournament instead threads scalar scores through sequential match calls over while loops.

Beyond the games

Not every entry is a game. Two entries host other languages on top of Crush — the first meta-programs in the collection (interpreters implemented inside an interpreter), both authored by Buffy (DeepSeek-v4):

  • forth/forth.crush — a Forth interpreter. Tokenizes a Forth source string with str.split, runs it on a fixed-size integer array used as a stack (plus a return stack for do/loop frames), and executes a genuine Forth wordset: numbers, + - * / mod, dup drop swap over rot, comparisons, output, if/else/then, and do/loop with i. Five programs run through it — stack arithmetic, Fibonacci, factorial, FizzBuzz, and a wordset smoke test — see forth/README.md.
  • brainfuck/brainfuck.crush — a Brainfuck interpreter. Walks a program one character at a time on a fixed-size byte tape, with bracket-matched loops. Its hard part is output: with no chr() and no conv.* in the standalone binary, a byte becomes a character by indexing a 95-character string of printable ASCII. Runs the classic Hello World, an A–Z loop, and a 0–9 loop — see brainfuck/README.md.

Unlike every game here, they use Crush's array mutation (stk[i] = v, tape[ptr] = v) and string capabilities rather than packing state into one integer. The "no mutable arrays" constraint below was true when the games were written — they predate (or independently missed) crush-ast's CRUSH-7 array fix — but arrays work now, and these are the entries that prove it.

Agent-written tools

Games show an agent can write Crush. The next question is whether you can let an agent write a tool and run it without reading every line. agents/log-triage/ is the first entry: a log summariser that declares exactly what it can touch (@capabilities [fs.list, fs.cat, time.now_iso]). crush-run caps shows what it needs without running it, a run without those grants is refused before anything executes, and a variant that quietly posts the summary to a server doesn't compile, or, if the agent also edits the declaration, is visible in that one line and refused by the same grants. See the README there for the whole walkthrough with real output.

Real language constraints every model had to work around

Discovered independently, converged on the same answers:

  • No mutable array index-assignment, no chainable .push(). All persistent per-tick state — ball position, board contents, scores, RNG seed — has to be passed as plain function arguments and threaded through recursive self-calls. Two different encoding strategies emerged: many separate scalar arguments (pong), or packing the whole board into a single integer via a positional radix (base-3 for tic-tac-toe's 3 cell states, a 25-bit field for Lights Out's 2).
  • No numeric RNG. Every game that needs "randomness" hand-rolls a seeded linear congruential generator, making every run fully deterministic and reproducible.
  • No interactive stdin, no sleep. Nothing here takes keyboard input — every game plays itself against itself (or, for Lights Out, against its own solver).
  • No cross-file import. The standalone crushc/crush-run toolchain cannot share code between .crush files: an import statement compiles to an unregistered module.load capability and the imported functions never resolve (every in-repo example that uses import is expect-error). This is why forth/ and brainfuck/ carry an identical scan() helper rather than a shared module — it is copy-pasted and documented as such in each file.
  • A real compiler bug, found chasing pong.crush's first version: a function whose body's last statement is if { return; } else { <call>; } — with nothing after — compiles to bytecode missing a terminator, and the VM crashes at runtime with truncated instruction at N. The one-line fix is a trailing return; after the if/else. Filed in crush-ast's own project memory (dejavue); tictactoe.crush and lights_out.crush both found it there and worked with it instead of hitting it blind.

Crush's AI-native annotations — genuinely used, and one real bug found

Crush ships a manifest-level annotation system aimed specifically at making code agent-legible — @module { purpose, exports, invariants, related }, @decision { chose, over, because, revisit-if }, @invariant { description, applies_to, check }, plus a few others (@wip, @temporary, @errors). game_of_life.crush uses three of them for real (documenting why the board is packed into an integer instead of an array, and the invariant that keeps it in bounds) rather than as decoration.

Verifying that surfaced a real compiler bug: crushc hangs indefinitely — not an error, an infinite loop — parsing @decision's revisit-if field. Isolated by bisection: @module alone compiles fine, @invariant alone compiles fine, @decision with chose/because/over[] all compile fine, but @decision { revisit-if: [...] } alone hangs with zero output. Almost certainly the field name itself — revisit-if — confuses the parser, since if is a reserved keyword immediately after the hyphen. This is very likely the actual root cause of crush-ast's own examples/crush/ai_agent_ops.crush, which is marked // expect-error: TIMEOUT and does use revisit-if — previously explainable by that file's unimplemented semantic_switch/ai_synthesize runtime calls, but the hang happens at parse time, before either of those would ever run. game_of_life.crush's own @decision block deliberately omits revisit-if, with a comment explaining why.

The runtime AI-expression layer (semantic_switch, ai_synthesize, ai_semantic_match) is a separate, further-out concept — not attempted here, and ai_agent_ops.crush's own expect-error marker already signals it isn't working code yet.

Running a game

Each game needs crush-ast's own compiler/runtime (crushc + crush-run):

cd crush-ast
cargo build --release -p crush-lang-sdk --bin crushc --bin crush-run
BIN=./target/release   # or wherever your cargo target dir puts release binaries

$BIN/crushc /path/to/awesome-crush/games/pong.crush -o /tmp/pong.cvm1
$BIN/crush-run run /tmp/pong.cvm1 --cap io.print --cap str.concat --max-steps 50000000

The --max-steps bump matters — these are real, non-trivial programs (pong.crush needs well over the VM's 1,000,000-instruction default once a board renders every frame), and the default budget is tuned for much smaller test fixtures.

What this repo is not

Not a benchmark, not a rigorous eval — one run each, n=1 per model, no statistical claims. It's a real, reproducible artifact of what happened when three models met the same unfamiliar language with the same minimal nudge. Take the comparison table as a genuine data point, not a verdict.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages