Idea · Sep 12, 2026
State Machine Story Engine
Students implement a finite state machine engine from scratch in TypeScript, then use it to build and publish an original interactive narrative game - earning deep FSM intuition through a creative deliverable peers can play.
What it would do
Students learn FSMs abstractly (vending machine diagrams) without building anything that runs. This multi-week assignment has two phases: (1) implement an FSM engine in TypeScript supporting states, transitions, guards, action callbacks, nested states, and a history pseudo-state; (2) use the engine to build an original interactive narrative game with at least three characters, two distinct endings, and a puzzle that requires reaching a specific FSM state sequence. A provided React+Vite game shell handles all rendering and keyboard input so students focus purely on the engine. An automated test harness validates the engine before the game phase begins. Finished games are published to a class gallery on Supabase where students play and review each other's stories. The assignment teaches FSM theory, event-driven programming, model-view separation, and TypeScript typing in a single arc.
Key features
- FSM engine specification: states, transitions with guard functions, entry/exit actions, nested states, history pseudo-state
- Automated test harness (Jest) that validates engine correctness before the game phase
- React+Vite game shell students drop their engine into with zero rendering work
- Supabase-hosted class game gallery with peer-play and a one-paragraph review rubric