Wave Function Collapse

Simple Terrain generation WaveFunction Collapse implementation in JavaScript.

Tiles are selected based on the tiles around them, and the possibility of each tile is updated based on the tiles around it using the following pattern:

When collapsing a tile, the entropy of each tile is calculated based on the number of possible types a tile could be, and a random tile is selected.

Refresh page to generate a new map.