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]>
20 lines
954 B
Markdown
20 lines
954 B
Markdown
# Naive engine: TypeScript
|
|
|
|
The throwaway engine for [Module 0, The Rewrite Trap](../../course/00-rewrite-trap/lesson.md). 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_runs` passes normally.
|
|
- `test_00_real_rules_whirlwind_order` is expected to fail. It states the real game's event order, which this engine cannot produce, so it is marked `test.fails`. To see the order the engine actually produces, change `test.fails(` to `test(` 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/`.
|