Naive engine in Rust and TypeScript (immediate damage, inline triggers, recursive Deathrattles, cards defined in the engine) with test_00_naive_runs and the expected-fail test_00_real_rules_whirlwind_order, plus the Module 0 lesson. Co-Authored-By: Claude Opus 5.5 <[email protected]>
954 B
954 B
Naive engine: TypeScript
The throwaway engine for Module 0, The Rewrite Trap. It is written the obvious way on purpose: minions are shared object references, damage applies at once, triggers fire inline, and a Deathrattle runs the instant a minion's Health reaches 0. Cards are defined inside the engine (makeMinion and cast in src/engine.ts).
Run the tests from this directory:
npm install
npx vitest run
You should see two passing tests:
test_00_naive_runspasses normally.test_00_real_rules_whirlwind_orderis expected to fail. It states the real game's event order, which this engine cannot produce, so it is markedtest.fails. To see the order the engine actually produces, changetest.fails(totest(and run the tests again.
npm run typecheck runs the TypeScript compiler.
Do not use this package in Module 1. Your real engine starts from workspace-template/ts/.