It is a world generating algorithm with rules regarding (a) what world states/tiles are possible in the world, (b) which state/tile is prohibited in certain location, based on other state(s)/tile(s) in (an)other location(s).

Think of the world like a sudoku game, where rule (a) number 1-9, (b) all square in a {row, column, big (3x3) square} must consist of unique numbers.

You can read the description of the algorithm in the readme of the original github repository mxgmn/WaveFunctionCollapse. The readme is already so comprehensive, so I won’t add much here. Enjoy.

Videos

Superpositions, Sudoku, the Wave Function Collapse algorithm. Martin Donald

Coding Challenge 171: Wave Function Collapse. The Coding Train