so basically wave function collapse is: imagine you have a 3x3 grid. and you have 4 biomes: grass, sand, water, and forest. all the tiles in your grid can be either of these. let's say you collapse the center tile, and it's grass. now grass can be next to everyone except water, so we collapse the tile next to it. now, because the robot making the world follows these rules carefully, we will never get an "illegal" world. (p.s.: these are just for world generation rules only, you can go to town in the comments making new instances this can be used on)
credit to the youtuber icoso, who's video about world generation inspired me to make this.