ZITRADER.PRG
WHAT IT IS.
Two paired repos that turn Gode and Sunder's 1993 zero-intelligence trader experiment into something you can either play or simulate. The game is zi-traders-game (Phaser 3.55 + ESLint, built with two checked-in esbuild-*.js scripts and the joystix monospace.ttf pixel font reused from the Galaga sprite path): a title.js scene plus a gameScene.js (379 → 930 → 2471 → 1645 lines across the project) and a zip_trader.js module that owns the trader state machine. The sim is zi-traders-sim (Vite + React, two commits) — src/ZITraders.jsx (730 lines) and src/zip_traders_sim.jsx (658 lines) ship the same trader logic headlessly, with vite.config.js configured for virtual-directory deployment (base: "/zi-traders-sim/"). The economics is shared across both: random offers subject to inventory and cash constraints, repeated trading periods, and market outcomes generated by the trading rules rather than strategic optimization. The UI flourish is the sprite the head commit names honestly: "Bids are baloons now" (baloon.png, 238 bytes).
THE ARC.
Game day one (Initial commit, 2025-09-08 19:13): package, two esbuild scripts, the pixel font, the title scene, the empty gameScene, the index files, the code-workspace, the LICENSE — 14 files, 7,604 insertions in one go. Three hours later (basic mechanisms working) is the core economics in code: zip_trader.js is born at 699 lines, gameScene.js grows to 930. Overnight (main loop working with periods) is the loop + the period counter — gameScene.js +412/−98, test_fixtures.js appears. Then a three-day pause while the sim next door gets initialised: Initial commit for zi-traders-sim (14 files, 4,417 insertions) and updated config for virtual dir deployment (Vite base toggled).
Three days of nothing, then the game refactor: Refactored — .vscode/{launch.json,settings.json,tasks.json} appear, title.js is deleted, gameScene.js swings 974/−870 across the refactor. Twelve hours later (added sprites) lands the salesman walking frames: 24 PNGs across walking-6-frames/{east,north,south,west}/frame_000..005.png and rotations/{east,north,south,west}.png. Sprites are moving and Bids are baloons now are the closing commits — sprite-anchored bids, a 60-second exposition of the Gode-Sunder claim.
Stack chips: Phaser 3.55 · esbuild (esbuild-build.js, esbuild-serve.js) · ESLint 9 (eslint.config.mjs) · joystix monospace.ttf pixel font · Phaser walking-frames sprite sheet (4 directions × 6 frames) · Vite (zi-traders-sim, base: "/zi-traders-sim/") · React 18 (sim UI).
WHAT I LEARNED.
A playable market makes the zero-intelligence result tangible: disciplined aggregate outcomes can emerge even when individual offers are random, provided the market imposes budget and inventory constraints.
Two repos, one mechanic: the game and the headless sim share the trader logic (
zip_trader.jsvs.zip_traders_sim.jsx) but different rendering surfaces (Phaser canvas vs. React). Splitting "playable" from "headless" up front means each one can be iterated without the other one breaking.Sprite assets are heavier than source code:
added spritesmoves 32 files (3,185 insertions, 116 deletions) for the walking-frames pack alone.Virtual-directory deployment is the cheapest possible hosting model — drop the built
dist/under any static path on a parent host and Vite's relative asset URLs just work.