gamedev-skills/puzzle
> pushes, tile logic), scoring, and undo. Use for a match-3, sokoban, or grid-logic puzzle.
npx skills add https://github.com/gamedev-skills/awesome-gamedev-agent-skills --skill puzzle
A playbook for grid/board puzzle games — the board model, move input, rule resolution
(matching, pushing, logic), scoring, undo, and level progression. This is a compositional
skill: it models board state and rules and presents them through a tilemap/UI. It does not
re-teach tilemaps; it defines the resolution loop and the correctness rules (clean state,
deterministic resolution, undo) that keep a puzzle fair and bug-free.
resolves by rules: match-3/tile-matching, sokoban/block-pusher, sliding puzzle, logic grid.
When *not* to use: real-time grid action with permadeath → roguelike. Card zones/turns →
card-game. Physics-based "puzzle platformer" → platformer + physics-tuning. For the tile
rendering, use godot-tilemap / unity-tilemap-2d.
**Read the board → plan a move → make the move → the board resolves by its rules (match, push,
fall, fill, cascade) → see progress toward the objective → repeat until solved/failed.** The
fun is the *planning*; the engine's job is to resolve each move deterministically and
present it clearly.
| Knob | Effect | Notes |
|------|--------|-------|
| Grid size / shape | complexity | Square is standard; hex/irregular change feel. |
| Match/push rule | genre identity | 3-in-a-row, shapes, push-into-goal, etc. |
| Cascade scoring | reward depth | Bigger chains = exponential payoff. |
| Move / time limit | pressure | Move-limited = puzzly; time = arcade. |
| Difficulty curve | learning | Introduce one mechanic at a time. |
| Undo depth | forgiveness | Single-step vs. full history. |
| Solvability guarantee | fairness | Generated boards must be solvable. |
| Deadlock handling | no dead ends | Detect no-moves; shuffle or end (refs). |
# Pseudocode. The board is the truth; rendering reads from it. (0,0) top-left, y grows down.
board = [[piece_or_empty for _ in range(W)] for _ in range(H)]
def find_matches(board):
matched = set()
for y in range(H): # horizontal runs of >= 3 equal pieces
run = 1
for x in range(1, W):
if board[y][x] and board[y][x] == board[y][x-1]: run += 1
else:
if run >= 3: matched |= {(y, k) for k in range(x-run, x)}
run = 1
if run >= 3: matched |= {(y, k) for k in range(W-run, W)}
# ... repeat the same scan vertically (columns) ...
return matched
# Pseudocode. One player move can trigger a chain; loop until the board stops changing.
def resolve(board):
chain = 0
while True:
matches = find_matches(board)
if not matches: break # stable: resolution complete
chain += 1
score += score_for(matches, chain) # later chain steps score more (see refs)
clear(board, matches) # remove matched pieces
apply_gravity(board) # pieces fall into the gaps
refill(board, rng) # spawn new pieces at the top (seeded RNG)
return chain
# Pseudocode. Snapshot before each move; undo restores it exactly (board + score + counters).
def make_move(move):
history.append(snapshot(board, score, moves_left)) # push BEFORE applying
apply(move); resolve(board); moves_left -= 1
def undo():
if history:
board, score, moves_left = history.pop() # exact revert, including resolution
For large boards prefer the command pattern (store the move + enough to invert it) over full
snapshots to save memory; snapshots are simplest and fine for small boards.
the single source of truth; the view only renders it.
(Pattern 2).
state, or make the move fully invertible.
from a known solution backward (refs).
and shuffle or end the level (refs).
board is stable.
godot-tilemap / unity-tilemap-2d for the grid; godot-ui-control for HUD, score, and menus.level-design for hand-authored puzzles and difficulty pacing; procedural-gen for solvable generated boards.save-systems for level progress, high scores, and seeded daily puzzles.game-feel for match/cascade pop, screen shake, and chain feedback; the engine animation/Tween skill for swaps/falls/clears; audio-design for match and chain cues.godot-gdscript / unity-csharp-scripting for the resolution loop and rules.sokoban/rule-based puzzles, undo strategies, solvable generation, and scoring, read
references/board-and-resolution.md.
Take gamedev-skills/puzzle from the repository into ~/.claude/skills for personal
use, or into .claude/skills inside a project.
The agent identifies a skill by the name field in its header. Two skills with the
same name cannot sit side by side — one of them will be ignored.