Kelly Mears

Constraint Propagation

Repeatedly narrowing the possible values of each variable using the constraints, until nothing more can be deduced.

Graphics & Rendering2 min read219 words11 out · 13 in
also calledCandidate eliminationSudoku solving

Constraint propagation is the core technique of constraint satisfaction: each variable holds a set of candidate values, and each constraint removes candidates that cannot possibly hold. Removing one candidate may enable another removal, so the process iterates until it reaches a fixed point.

Sudoku is the clearest example. Every cell begins with nine candidates; each filled cell eliminates that value from its row, column, and box. Two deductions do most of the work: a cell with exactly one remaining candidate must hold it, and a value with exactly one remaining position in a unit must go there. Puzzles solvable by these alone are "easy"; harder ones require techniques reasoning about pairs of candidates, and the hardest require search with backtracking.

This also explains what puzzle difficulty is: not how many cells are blank, but which deduction techniques are required. A generator that removes clues at random produces wildly inconsistent difficulty; one that solves as it removes, and stops when the required technique exceeds a target, produces consistent difficulty.

The same structure appears in type inference, scheduling, layout solvers, and dependency resolution. And it has a direct interface consequence: an application that tracks candidates can offer to fill in forced cells, mark them, or eliminate them automatically — automating exactly the bookkeeping while leaving the interesting deductions to the player.

See also11

Game AI

Computer opponents built to be interesting to play against rather than optimal.

Play & Games26 connections

Roguelike

A genre defined by procedurally generated runs and permanent death, and the design pressures those create.

Play & Games28 connections

Cellular Automaton

A grid of cells whose states evolve by a local rule applied simultaneously everywhere.

Graphics & Rendering14 connections

Trick-Taking Game

A card-game family in which players contest a series of small rounds, and a source of unusually clean rule systems.

Play & Games11 connections

L-System

A rewriting grammar that generates branching structures by repeated substitution.

Graphics & Rendering11 connections

Voxel

A volumetric pixel — a value on a regular three-dimensional grid.

Graphics & Rendering14 connections

Seeded Randomness

Pseudorandom generation from an explicit seed, so any output is reproducible.

Graphics & Rendering25 connections

Procedural Generation

Creating content algorithmically rather than authoring it by hand.

Graphics & Rendering32 connections

Determinism

The property that identical inputs produce identical outputs, and the foundation of caching and verification.

Systems & Tooling61 connections

Shader

A small program run on the graphics processor for every vertex or every pixel.

Graphics & Rendering22 connections

Backtracking

Searching for a solution by making choices one at a time and undoing the latest choice when it leads nowhere, the method behind puzzle solvers, regex engines, and dependency resolvers.

Computation & Algorithms8 connections

Linked from13