dazgupta.com > posts.xml 2> journal.xml

Tile adjacency for WFC

Today I managed to implement and verify the implementation of tile adjecency rules. Now I know which tiles can go next to which tiles. I have this thought more and more that the Wave Function Collapse algorithm is quite magical.

This is how the interface / test looks like,

fn left_adjacency_satisfied() {
    let str_rep = "\
    let tile1 = WorldTile::from_str(str_rep, 3);

    let str_rep = "\

    let tile2 = WorldTile::from_str(str_rep, 3);
    let result = tile1.compatible(&tile2, Direction::LEFT);

    assert_eq!(result, true)

The second tile can go on the right of the second tile.