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

WFC Tile generation day

Today I managed to get some parts of the wave function collapse algorithm up and running for my non-game game; tile generation. As of now, tiles are basic non-rotational, non-reflectional.

Had to add some for-convenience string representation to write tests with. The tests look a bit like these,

fn get_tiles_from_sample_single_entity() {
    let str_rep = "\
    BBBB\
    BBBB\
    BBBB\
    BBBB\
    ";

    let sample = WorldSample::from_str(str_rep, 4);
    let tiles = sample.create_tiles(3);

    assert_eq!(tiles.len(), 1)
}
fn get_tiles_from_sample_16() {
    let str_rep = "\
    B~BB\
    T~B!\
    ~~^!\
    TT~~\
    ";

    let sample = WorldSample::from_str(str_rep, 4);
    let tiles = sample.create_tiles(3);

    assert_eq!(tiles.len(), 16)
}

23-12-2023