Returning to the module boundaries
I wrote this Haskell falling-block game around May 2025. The surviving source divides the work into six modules: Main starts Gloss; Game.Types defines shapes, pieces, state, offsets, and collisions; Game.Logic advances play; Game.Rendering draws the board and text; Game.UI handles keyboard events; and Utils supplies colors and random shapes. That organization gave me a useful map when I returned to it.
My October 2026 goal was to recover behavior in stages. The original graphical source survives and my authorship is confirmed, but the course prompt is unavailable. I worked from the implementation itself, preserved it separately, and described the game it actually contains.
Establishing the rules before changing the build
I first bounded the behavior I was trying to recover: a 10-by-20 board, seven shapes, four rotations per shape, collision detection, arrow-key movement, space-key rotation, and one gravity step per update. Pieces lock, completed rows disappear, each cleared row adds 100 points, and new pieces spawn until game-over.
That list kept the restoration focused. Wall kicks, hold or preview, increasing levels, lock delay, and restart are outside the verified implementation. A familiar game name carries many expectations, so I wanted the supported rules visible before presenting the restored version.
The challenge: test the rules without the unavailable dependencies
The original application depended on graphical and other external packages that were unavailable in the review environment. I preserved that source and created a testable edition: a small local V2 coordinate type replaces the external vector type, and deterministic transitions live in Game.Rules. This let me investigate behavior while the original GUI remained unbuilt.
The key decision was to pass the next shape into the transition explicitly. stepWith receives that choice, so a test can repeat the same board, active piece, and next shape. Removing the random draw from this boundary made failures reproducible. The deterministic sequence belongs to the restoration and its tests; it is not a claim about the original graphical game.
Checking geometry before animation
I could reason about geometry without drawing a frame. Each shape has four lists of four offsets, and pieceCoords translates the selected offsets to the active piece’s position. That representation exposes the occupied cells independently of pixels, colors, and frame timing.
The restoration checks visit all seven shapes, confirm four blocks per shape, and check a four-rotation cycle. Movement and rotation use the same reviewable pattern: create a candidate, validate it, then commit it only if valid. tryShift and tryTurn put that rule into small functions that can be exercised directly.
Collision checks cover horizontal limits, the floor, and occupied board cells, and input is frozen after game-over. The original graphical UI has equivalent guard-based handling. Extracting the functions gave me a smaller deterministic surface for checking those responsibilities.
Following one tick through its consequences
The order inside a gravity transition

In my restored Haskell rules, I first try moving the active piece down one cell and check its proposed position against the board’s collision rules. If it fits, I move only that piece and leave the settled board unchanged. I provide the next shape explicitly so tests can repeat the same transition, while the original graphical application’s real-time behavior remains unverified.
Read all step descriptions
- Attempt a fall
In my restored Haskell rules, I first try moving the active piece down one cell and check its proposed position against the board’s collision rules. If it fits, I move only that piece and leave the settled board unchanged. I provide the next shape explicitly so tests can repeat the same transition, while the original graphical application’s real-time behavior remains unverified.
- Lock if blocked
If the downward move is blocked, I add the active piece to the settled board before checking for completed rows or creating the next piece. This order lets each later operation use the board produced by the previous one. I examine this repeatable rules path separately from the surviving Gloss graphical interface, which remained unbuilt because its required software packages were unavailable.
- Clear and score
After settling the piece, I remove rows containing all ten cells, move each remaining cell down by the number of cleared rows beneath it, and add 100 points per removed row. I check the remaining positions as well as the score to see whether the board changed correctly. As a documented 2026 repair, I also remove repeated board coordinates so duplicate entries cannot falsely count as a complete row.
- Spawn and check
After clearing rows, I place the explicitly supplied next shape and check whether its starting position is blocked or the board retains cells above the visible area. I added these game-ending conditions in the 2026 repair so the restored rules address the board’s top boundary. The rule checks and terminal demonstration passed, while the original graphical display and real-time interaction remain unverified.
I traced a gravity transition in order. First it attempts one downward move. If that succeeds, only the active piece moves; the settled board stays the same. If it fails, the piece joins the board, completed rows are cleared, the score changes, and the supplied next shape spawns.
The sequence matters because every stage changes the input to the next. A useful line-clear check inspects surviving coordinates as well as score. A spawn check starts from the board after clearing, because removing a row can change whether the next piece fits. These were the interactions I wanted the isolated rules to expose.
clearLines identifies rows containing all ten horizontal positions, removes them, and lowers each remaining cell by the number of cleared rows below it. In the restored version, coordinates are deduplicated so repeated entries cannot count as a full row. The scoring rule stays explicit: each removed row adds 100 points, so two removed rows add 200.
A second challenge at the top of the board
The original collision helper allowed coordinates above the visible board. That can let a piece enter from the spawn area, but it leaves a separate question: when does occupancy above the display end the game? Treating every boundary as an ordinary movement collision would miss that distinction.
The restored rules add explicit top-out checks. Play ends if the locked board retains cells above the visible 20-row area or if the next spawn is blocked. These are documented October 2026 repairs. They improve the restored rules without being read backward as features already verified in the original submission.
Giving the restored rules a second frontend
I added TerminalMain in October 2026 to demonstrate the tested rules. It cycles through pieces deterministically and advances one tick for each entered command. The controls are a and d to move, w to rotate, s or Enter for a tick, and q or end-of-input to exit.
That made an offline rules demonstration possible, with an interaction model I needed to label accurately. This terminal edition is turn-based; the historical Gloss application is graphical and real-time. Any terminal image or recording belongs to the new frontend and its restoration date.
The verified result and the next boundary
The October restoration record contains 24 passing rule checks and a successful scripted terminal session under GHC 9.8.4. A graphical typecheck was attempted and failed because Graphics.Gloss and System.Random were unavailable. No additional graphical dependencies were installed, so original GUI rendering and real-time interaction remain unverified.
I extracted deterministic rules, repaired two rule boundaries, added tests, and built the terminal frontend. I also removed a dangling Cabal reference to an absent license file and documented that gap without inventing a permission grant. A supported graphical build and interactive run remain the next steps; separating state transitions made the game much easier to investigate.
I preserved the original implementation, extracted deterministic transitions, and repaired rule boundaries in October 2026. Twenty-four rule checks and a terminal session passed under GHC 9.8.4; the original GUI remained unbuilt and unrun because Gloss and random were unavailable.
Validation & limitations
- I preserved the original implementation, extracted deterministic transitions, and repaired rule boundaries in October 2026. Twenty-four rule checks and a terminal session passed under GHC 9.8.4; the original GUI remained unbuilt and unrun because Gloss and random were unavailable.
Project records
- Project artifacts and historical records, May 2025, approximate month; exact submission date unknown
- Restoration and public documentation, October 1, 2026
