← Work

2026

Grand Line

Deterministic, replayable rules engine for a trading card game

A pure reducer with seeded RNG, card effects as a data DSL, around 200 cards, 57 tests, and a browser match against an AI.

Problem

A trading card game has hundreds of cards with their own rules that interact with each other. Build an engine for it and you quickly end up with code nobody can test – and games that cannot be reproduced when a bug shows up.

Solution

The engine is a pure reducer: state in, action in, new state out, no side effects. Randomness comes from a seed, legalActions() is the single source of truth for permitted moves, and card effects are data in a small description language rather than hand-written special cases. Card data arrives through an ingest pipeline from a public API.

Result

Around 200 cards, 57 tests, and every game can be replayed exactly from its seed and move list. In the browser you play against an AI. The project is my evidence for architecture and test discipline – the same principles I build client projects on.