I’ve had a long time fascination with Conway’s Game of Life, and with the Sigbla APIs starting to stabilize I thought it would be fun to play around a bit and implement it as an example.

You can find the Conway example code here, and it should hopefully, even if you’re unfamiliar with Sigbla, be fairly straight forward to understand.

It’s using various core features, such as views, batching, transformers and cloning, with about 100 lines of code to get it all working. It’s not really what I would envision Sigbla being used for, but it’s a fun little example…

Conway's Game of Life in Sigbla

  • breadsmasher@lemmy.world
    link
    fedilink
    English
    arrow-up
    4
    ·
    7 months ago

    interesting! Hadnt seen sigbla before - nice use.

    Just curious,

    
    // Add some logic to detect when we're stuck in a loop
    boards.add(conway.map { true in it }.toList().hashCode())
    
    … 
    
        if (boards.size < 5) {
            // Stuck in loop, add some randomness
    
    

    What do you mean with stuck in a loop? Is it where the game reaches a state where its cycling continuously through the same variations repeatedly?