"A real Tetris loop has time (ticks), concurrent inputs (keystrokes), state transitions (collision, locking, line clears), and non-determinism (piece generation). In many imperative designs, these concerns end up tangled in shared mutable state, which tends to produce bugs that are: hard to reproduce (timing-dependent), hard to test (logic mixed with effects), hard to debug (replay isn't deterministic)."
"Here's a common failure mode when ticks and inputs race on shared mutable state: At time t, the player presses MoveDown At nearly the same time, the Tick arrives Both handlers read the same state (same falling piece position) Both apply "move down" and write back Depending on scheduling, you can get: a double-step fall, a collision check on a stale position, a lock/clear occurring "too early," a bug that disappears under debugging (classic heisenbug)."
A real Tetris loop involves ticks, concurrent inputs, state transitions, and non-determinism, which often become tangled in shared mutable state in imperative designs. Tangled concerns produce timing-dependent, hard-to-test, and non-deterministic bugs. Monadris separates a pure core (domain and rules) from an impure application layer (I/O, timing, rendering) and models the game as a deterministic state machine driven by events. Events are queued and processed one-by-one, preventing concurrent handlers from racing on shared state. Core rules become deterministic and testable without runtime, and deterministic replay becomes possible by recording the event stream.
Read at Medium
Unable to calculate read time
Collection
[
|
...
]