Grid-Based Games
First developed in the author’s SoftwareX paper and refined through his blog, grid-based games (GBGs) establish the pedagogical and creative foundation of this book. They frame board games, puzzles, simulations, and automata within a discrete, rule-driven model where interaction, logic, and visualization emerge cell by cell on a finite grid. In this setting, grids become active models for reasoning about rules, data, and behavior—the same principles that structure programming and design.
Definition and Core Principles
Grid-based games are built upon a discrete rectangular grid—an object of cells, each addressable by row and column and capable of storing any valid JavaScript value. This grid drives rules, movement, and visual feedback, and every interaction is ultimately cell-based.
This paradigm spans classics like Chess and Go, logic staples such as Sudoku and Nonograms, and digital icons including Tetris and Into the Breach. Despite their variety, all share the same underlying principle: gameplay unfolds through discrete interactions on a finite grid.
Why Grids Matter
Grids make programming visible and traceable. Each cell exposes its state, every rule leaves a spatial trace, and computations can be observed step by step as motion, color, or pattern. This direct feedback turns code into behavior, letting learners see how logic unfolds through cause and effect.
They also promote structured reasoning and creative constraint. Grid geometry encourages modular thinking—rows, columns, neighbors, and boundaries—mirroring how arrays, functions, and classes organize data and flow. Bounded by simple rules yet open to endless variation, GBGs foster computational thinking through the interplay of code, design, and play.
Taxonomy of Grid Play
While grids share a common structure, the ways players interact with them vary widely.
Each category below captures a distinct mode of play—how players engage with cells, apply rules, and perceive space—illustrating the versatility of grid-based design.
Movement & capture.
Turn-based play on a square lattice where pieces move or capture along fixed paths, as in Chess or Checkers.Territory, flips & connection.
Spatial control through linking, alignment, or flipping; cells change ownership or color through adjacency—seen in Go and Reversi.Constraints & words.
Deductive puzzles where numbers or letters must satisfy per-cell constraints—such as Sudoku or Crossword.Tile motion & elimination.
Tiles fall, swap, or slide under gravity or adjacency rules—rows or groups clear cell by cell, as in Tetris or Bejeweled.Turn-based tactics.
Units occupy terrain cells and act per turn, each move resolving cell by cell—exemplified by Advance Wars or Into the Breach.Roguelike & dungeon crawler.
Stepwise exploration of procedural maps, with each cell potentially holding terrain, items, or entities—like NetHack or Brogue.Real-time tile action.
Time-driven motion and collisions constrained to tile positions, as in Bomberman or Pac-Man.0-player automata.
Self-evolving systems where all cells update simultaneously by local rules, producing global behavior—famously Conway’s Game of Life.
The table below summarizes these categories, highlighting their defining grid mechanics and emblematic examples.
| Category | Core grid mechanic | Examples |
|---|---|---|
| Movement & capture | Turn-based play on a square lattice; moves and captures follow patterns | Chess, Checkers/Draughts, Shogi, Xiangqi |
| Territory, flips & connection | Spatial control through linking, alignment, or flipping of cells | Go, Reversi/Othello, Connect Four, Gomoku |
| Constraints & words | Per-cell deduction or letter placement under explicit constraints | Sudoku, Nonogram/Picross, Scrabble, Crossword, Boggle |
| Tile motion & elimination | Gravity, swaps, or slides; matching clears rows or groups per rule | Tetris, Dr. Mario, Puyo Puyo, Bejeweled, Candy Crush Saga, Sokoban, 15-puzzle, Minesweeper |
| Turn-based tactics | Units act per turn on grid cells; effects and ranges are cell-scoped | Advance Wars, Into the Breach, Wargroove, Final Fantasy Tactics |
| Roguelike & dungeon crawler | Stepwise per-cell movement; items, enemies, and FOV define progression | NetHack, Dungeon Crawl Stone Soup, Brogue |
| Real-time tile action | Continuous or timed movement constrained to tile positions | Bomberman, Pac-Man |
| 0-player automata | Local rules applied in parallel across all cells over discrete steps | Conway’s Game of Life, Day and Night, Critters |
GBGs as a Learning Pedagogical Framework
Grid-based games provide a practical framework for learning through creative coding and play. Their discrete structure mirrors core programming ideas—state, rule, and iteration—while their visual feedback makes logic immediate, observable, and testable.
By designing interactions at the cell level, learners naturally engage with different programming paradigms in context:
- Declarative, when describing patterns or winning conditions.
- Functional, when applying transformations across the grid.
- Object-oriented, when defining entities that act within it.
Each paradigm reinforces the others through direct visual feedback, turning abstraction into behavior.