Dmars – 一套现代化的 Core Wars 工具链
Dmars – A modern Core Wars toolchain

原始链接: https://dmars.drpz.xyz/

**dmars** 是 pMARS 的高性能 Rust 重写版本。pMARS 是 Core War 的标准工具链,这是一款 1984 年的经典编程游戏,玩家通过编写自我修改的 Redcode 程序,在共享内存阵列中争夺控制权。 主要功能包括: * **完全兼容:** 汇编器支持 ICWS'94 预处理器标准,并生成与 pMARS 字节兼容的输出。同时包含 ICWS'88 兼容模式。 * **高性能:** 在单场对战中与 pMARS 表现相当,而在多线程执行方面,dmars 表现出色,在大规模模拟中显著提升了运行速度。 * **多功能性:** 该工具可编译为 WebAssembly,支持交互式浏览器实验场,用户可以在其中编写代码并观看战士对战。 * **强大的工具集:** 命令行界面支持汇编、运行和模拟比赛,并包含用于可视化和回放战斗过程的终端 UI。 dmars 是开源项目(GPL-2.0+),可通过 Shell 脚本或 Cargo 轻松安装,是 Core War 爱好者的高效现代选择。

抱歉。
相关文章

原文
dmars — a Redcode assembler and Core War 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 — sourcereleasesplaygroundGPL-2.0-or-later

联系我们 contact @ memedata.com