Domino tilings are coverings of a region on the square lattice by 1×2 or 2×1 dominoes (dimers), where each cell is covered by exactly one domino. They arise in statistical mechanics as dimer models, in combinatorics through connections to Young tableaux and the RSK correspondence, and in probability theory where random tilings exhibit fascinating limit shapes and fluctuations.
This simulator generates uniformly random domino tilings of arbitrary regions that you draw.
How to use:
- Draw mode: Click or drag on the grid to add cells to your region
- Erase mode: Remove cells from your region (or hold Shift while drawing)
- Lasso: Click points to define a polygon, then fill or erase the interior. Supports Snap to Grid for precise lattice alignment.
- Rectangle/Aztec Diamond: Quick presets for common shapes
- Scale Up/Down: Double or halve the region size
- Smooth Scale Up: Scale preserving boundary slopes (Aztec→Aztec)
- Make Tileable: Automatically add cells to make an invalid region tileable
- Undo/Redo: Full history support for shape modifications
A region is tileable if it has equal numbers of black and white cells (checkerboard coloring) and admits a perfect matching. The Hopcroft-Karp algorithm verifies this and finds an initial tiling.
Sampling methods:
- Glauber dynamics: Markov chain Monte Carlo with local 2×2 plaquette flips. Converges to the uniform distribution; good for watching the mixing process. Works for all regions.
- Perfect Sample (CFTP): Coupling From The Past produces an exact sample from the uniform distribution using monotone coupling on height functions. No burn-in needed. Only available for simply-connected regions (no holes).
Visualization Modes:
- 2D Domino: Standard flat tiling view with four colors for domino types.
- 2D Dimer: Displays the underlying matching on the dual graph as edges.
- 3D Height Function: Renders the tiling as a stepped surface in 3D space. Supports rotation, panning, zooming, perspective/orthographic toggle, and multiple visual presets (Default, Clean, Mathematical, Dramatic, Playful).
- Color Palettes: Multiple color schemes available, with permutation support to cycle colors.
Sampling & Analysis:
- Double Dimer: Superimposes two independent CFTP samples to form loops. Includes a Min Loop Size filter to analyze loop statistics.
- Fluctuations: Visualizes the height difference between two perfect samples (scaled by √2), approximating the Gaussian Free Field.
Data Export:
- PNG: Export high-quality images with adjustable quality settings.
- JSON: Import/Export the region shape for sharing or later use.
Performance: The simulation runs entirely in your browser. When available, it uses WebGPU compute shaders for parallel CFTP and Double Dimer sampling. On systems without WebGPU, it falls back to WebAssembly.