dmars — a Redcode assembler and Core War simulator
Core War is the 1984 programming game in which self-modifying programs, written in a pseudo-assembly language called Redcode, battle for control of a circular memory array called the core. The last program (or "warrior") with a running process wins.
dmars is a Rust reimplementation of
pMARS, the canonical Core War toolchain. The
assembler handles the full ICWS'94
preprocessor and produces load-file output byte-compatible with pmars -A. The simulator runs battles
between assembled warriors, with
ICWS'88 restrictions available behind a flag.
The same core compiles to WebAssembly, which is what's running the battle below. You can also check out the full browser playground, where you can write and fight your own warriors.
loading wasm…
Classic warriors from the 1990s hills battling live in your browser. Open the playground to write your own.
When running a single battle, dmars roughly matches pMARS's performance. It is significantly faster when running many battles, running them in parallel where possible.
500 rounds, Aeka vs Flash Paper — Apple M3 Pro. Identical tallies both ways: 7 11 482.
pmars -b -f -r 500 aeka.red flashpaper.reddmars run -f -r 500 aeka.red flashpaper.red
pMARS 0.9.4 compiled -O3; dmars single-threaded (-j 1) runs the
same 500 rounds in 0.78 s.
Shell installer (macOS and Linux):
curl --proto '=https' --tlsv1.2 -LsSf
https://github.com/drivasperez/dmars/releases/download/v0.2.0/dmars-installer.sh | sh
Cargo:
cargo install --locked --git https://github.com/drivasperez/dmars
Pre-built binaries are available on the latest GitHub release.
-8)dmars 0.2.0 — source — releases — playground — GPL-2.0-or-later