dmars(6) — dan's memory array redcode simulator

NAME

dmars — a Redcode assembler and Core War simulator

DESCRIPTION

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.

CORE

loading wasm…

Classic warriors from the 1990s hills battling live in your browser. Open the playground to write your own.

PERFORMANCE

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.red
0.77 s
dmars run -f -r 500 aeka.red flashpaper.red
0.10 s (7.5×)

pMARS 0.9.4 compiled -O3; dmars single-threaded (-j 1) runs the same 500 rounds in 0.78 s.

INSTALL

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.

USAGE

dmars assemble warrior.red
Assemble Redcode into an ICWS'94 load file on stdout
dmars assemble -o warrior.rc warrior.red
Write the load file to a path instead
dmars assemble -8 warrior.red
Enforce ICWS'88 restrictions (pMARS -8)
dmars run a.red b.red
Run warriors against each other in the simulator
dmars run -r 100 a.red b.red
Fight 100 rounds with random starting positions and report the score
dmars watch a.red b.red
Visualise a battle in an interactive terminal UI — play, pause, scrub the timeline, inspect cells
dmars --help
Full options

  

dmars 0.2.0 — source — releases — playground — GPL-2.0-or-later