Assembly warriors battle for 8,000 cells of shared memory on a real Redcode VM.
Five classic warriors (imp, dwarf, scanner, paper and vampire) are assembled from real Redcode and loaded into one circular memory, and the virtual machine runs one instruction per warrior per cycle until only one has processes left. The interpreter follows the ICWS'94 rules: 16 opcodes, 7 modifiers, all 8 addressing modes with pre-decrement and post-increment pointers, and per-warrior process queues fed by SPL, so takeovers like a scanner running a paper's stolen code happen on their own. Memory is drawn as concentric rings of 8,000 tiles; a per-pixel lookup table maps every pixel to its cell, so the whole mosaic repaints in one pass over an ImageData buffer each frame. Cells take the color of whoever last wrote them, DAT cells are hollow, executing cells flash white and long-range writes leave fading arcs.
Try it. Click the ring to drop a fresh warrior there (choose which with the Drop button or keys 1 to 5). Hover any cell to read its instruction in the memory panel. Space pauses; while paused, a click pins a cell and Left and Right walk through memory. Plus and minus change speed, and N starts a new round.
Paste this into Claude Code, Codex or any coding agent to get a simple version running, then take it wherever you like.
Build a small Core War arena with JavaScript and the HTML canvas element: tiny assembly programs fighting inside a shared circular memory. Put everything in a single index.html file with no libraries or build step, so I can open it directly in a browser.
Start simple:
- Make a canvas that fills the window, stays sharp on high-DPI screens (scale by devicePixelRatio), and resizes with the window. Use a near-black background.
- Create a memory of 4,000 cells, each holding an instruction: an opcode, an A field and a B field, plus the id of the program that last wrote it. All addresses are relative to the current cell and wrap around.
- Implement four opcodes: DAT (the process dies), MOV (copy a cell), ADD (add to a field) and JMP (jump), with two addressing modes: immediate (#) and direct.
- Load two classic warriors far apart: the imp (MOV 0, 1, which copies itself forward forever) and the dwarf (ADD #4 to a pointer, MOV a DAT bomb to where it points, JMP back).
- Each frame, run a few hundred cycles, alternating one instruction per warrior. A warrior loses when it executes a DAT.
- Draw memory as a grid of small squares, colored by the warrior that last wrote each cell, with the cell each warrior is about to execute highlighted.
Once that works, make it beautiful:
- Lay the cells out around a ring instead of a grid, and fade each cell from bright to a soft tint as its last write ages.
- Add the @ indirect addressing mode and SPL, which gives a warrior a second process; keep a queue of processes per warrior and run them in turn.
- Show each warrior's name, color and process count, and announce the winner before starting a new round.
Explain the key ideas in short code comments. When you're done, tell me how to open it and suggest three directions I could take it next, such as the full ICWS'94 rules with pre-decrement and post-increment modes, a self-replicating paper warrior, or clicking the memory to drop new warriors.