Page 1 of 1

Conway's Game of Life

Posted: Sat Dec 09, 2023 8:49 pm
by [object Object]
Implements Conway's Game of Life (lmao).

This hex summons a wisp that runs one step of the game every 4 ticks (adjust by replacing the number literal at index 1). It clears the previous step just before the next iteration by making a bunch of lines behind the grid to hit the particle limit - that's why it flickers sometimes.

The game board is a 2D list (up to 21x21, displayed on a 10x10 block grid) containing only 0 and 1, with wrapping edges. The wisp will overwrite the board if a new one is received over a link. You can use this script to build that list and write it to a focal port: https://pastebin.com/CXE2Qqff

Macros used: Toroidal Selection Gambit, Perfect Counter's Queue

Video demo: https://youtu.be/pU1vzyBSMTk (contains flickering lights)
Patterns
qqqqqqawqqqNumerical Reflection: 3aqawdedaadaaaaaadaaeeeeeqdNumerical Reflection: 7.984375waqawwaawNumerical Reflection: 2ewdqdweaadaaqaeaqaadaaqaeaqaadaaqaeaqaadaaqaeaqaadaaqaeaqaadaaqaeaqaadaaqaeaqeqqqqaweeeeewaadaaawqqqeqqwawqaawBookkeeper's Gambit: Drop 1eeeqwaeawqawdddeaqqNumerical Reflection: 0adeeedadeeedqeewdweddwdwqqqawqqqBookkeeper's Gambit: Drop 1, Keep 2ddqaaqaeaqweeeeeaaeaaqqqawqqqddqaaqaeaqweeeeewaawwaawddqddddqaaqaeaqweeeeewaawwaawaaeaawaawddqddddqaaqaeaqweeeeeNumerical Reflection: 36qaawddewaawwaawNumerical Reflection: 0Numerical Reflection: 0Numerical Reflection: 4ddadNumerical Reflection: 1Numerical Reflection: 0Numerical Reflection: 5aadaadaaNumerical Reflection: 9ewdqdweaawdddeeedddqddNumerical Reflection: 0eqqqqqNumerical Reflection: 0.5waqawNumerical Reflection: -5aadaaNumerical Reflection: 1.0625eqqqqqwaawqeeeeeaawddNumerical Reflection: -1waqawaawddeqqqqqdedwqqwdedwqqawaawaawaaeddawqqqeqqqqaBookkeeper's Gambit: Drop 1eeeqwaeawqawdddeaqqqqqaweeeaaeddaqaeaqwwaadadadadadBookkeeper's Gambit: Drop 4, Keep 1qqqaweeeaaeddaqaeaqwwaadadadadadeqqwawqaawBookkeeper's Gambit: Drop 1qqqaweeeqaqaaqaqwawqaawddNumerical Reflection: 0.5Numerical Reflection: 0.5Numerical Reflection: -0.5eqqqqqwaawNumerical Reflection: 100aqaweewaqaweeeee

Code: Select all

{
    Consideration: { // wisp
        // wait between steps to reduce flickering
        Numerical Reflection: 3
        Delay Wisp

        // clear existing particles by hitting the particle limit with a line behind the plane
        // coordinates: +x right, +y up, +z toward camera
        Gemini Decomposition
        Compass' Purification
        
        Gemini Decomposition
        Vector Reflection -Z
        Numerical Reflection: 7.984375 <SOUTH_EAST aqaaedawddwddweddq>
        Multiplicative Distillation
        Additive Distillation

        Numerical Reflection: 2
        Flock's Gambit

        // 7 doublings should produce 20145 particles
        Gemini Decomposition
        Combination Distillation
        Gemini Decomposition
        Combination Distillation
        Gemini Decomposition
        Combination Distillation
        Gemini Decomposition
        Combination Distillation
        Gemini Decomposition
        Combination Distillation
        Gemini Decomposition
        Combination Distillation
        Gemini Decomposition
        Combination Distillation

        Particles
        
        // load new grid from link message, if any
        Recitation Reflection
        Gemini Decomposition
        Augur's Purification
        {
            Huginn's Gambit
            Bookkeeper's Gambit: v
        }
        Flock's Disintegration
        Augur's Exaltation
        Hermes' Gambit
        
        // default grid (can't be an empty list, PCQ breaks)
        Numerical Reflection: 0
        Single's Purification
        Single's Purification
        Muninn's Purification
        
        Consideration: { // for row in grid
            Bookkeeper's Gambit: v--
            Undertaker's Gambit
            Toroidal Selection Gambit
            Rotation Gambit

            Consideration: { // for cell in row
                Undertaker's Gambit
                Toroidal Selection Gambit
                Additive Distillation
                Additive Distillation
                
                Rotation Gambit II
                Undertaker's Gambit
                Toroidal Selection Gambit
                Additive Distillation
                Additive Distillation

                Rotation Gambit
                Additive Distillation
                
                Rotation Gambit II
                Undertaker's Gambit
                Toroidal Selection Gambit

                Numerical Reflection: 36
                Swindler's Gambit // bdace
                Additive Distillation
                Additive Distillation
                
                // 0 or 1 neighbours (die)
                Numerical Reflection: 0
                Numerical Reflection: 0

                // 2 neighbours (persist)
                Numerical Reflection: 4
                Fisherman's Gambit

                // 3 neighbours (live)
                Numerical Reflection: 1

                // 4-8 neighbours (die)
                Numerical Reflection: 0
                Numerical Reflection: 5
                Gemini Gambit

                Numerical Reflection: 9
                Flock's Gambit
                Jester's Gambit
                Selection Distillation

                // (i, j, 0)
                Rotation Gambit II
                Numerical Reflection: 0
                Vector Exaltation
                
                // max integer grid size in wisp ambit: 11
                // max integer thothable 2D list: 22
                // 11/22 = 0.5
                // (dividing by 2 causes a mishap because of a hex bug (hexbug!))
                Numerical Reflection: 0.5
                Multiplicative Distillation
                
                // center grid on x/y axes and shift toward camera
                Numerical Reflection: -5
                Gemini Decomposition
                Numerical Reflection: 1.0625
                Vector Exaltation
                Additive Distillation

                // flip y axis
                Vector Disintegration
                Jester's Gambit
                Numerical Reflection: -1
                Multiplicative Distillation
                Jester's Gambit
                Vector Exaltation
                
                // translate grid to wisp position
                Identity Reflection
                Compass' Purification
                Additive Distillation
                
                // draw cell!
                Prospector's Gambit
                Augur's Purification
                {
                    Particles
                    Bookkeeper's Gambit: v
                }
                Flock's Disintegration
                Augur's Exaltation
                Hermes' Gambit
            Consideration: }

            Prospector's Gambit
            Abacus Purification
            Perfect Counter's Queue
            
            Thoth's Gambit
            Bookkeeper's Gambit: vvvv-
        Consideration: }
        
        Prospector's Gambit
        Abacus Purification
        Perfect Counter's Queue

        Thoth's Gambit
        Huginn's Gambit
        Bookkeeper's Gambit: v
    Consideration: }

    Mind's Reflection
    Compass' Purification
    Mind's Reflection
    Alidade's Purification
    Archer's Distillation

    // center wisp on block edge, and move away from camera to hide particles
    Numerical Reflection: 0.5
    Numerical Reflection: 0.5
    Numerical Reflection: -0.5
    Vector Exaltation
    Additive Distillation

    Numerical Reflection: 100
    Summon Cyclic Wisp
}