🏠 home

better cellular automata in ORCΛ

2023-11-02

The initial version of cellular automata in ORCΛ wouldn't let me rest, so I made a better one.

My first version of 1d cellular automata in ORCΛ [1] was very limited: It could plot a playing field of 18 cells width at most. For some reason my brain wouldn't let go of this and kept returning to the problem of expanding the width.

What I've come up with is a relay system that transmits information over longer distances but also over several time steps. This mandated a stoppable clock to allow signals to reach the other end of the field before being read.

Ultimately the solution has an elegance in simplicity but it took a couple of hours to figure out.

I've also rewritten the part that reads the three neighbouring cells from the playing field before calculating the value for the cell to be written. Devine, the creator of ORCΛ kindly pointed me to the `Q` operator as a better alternative of using three separate `O`.

screenshot: generating Sierpinsky triangles.
    .....cVo...Vc.......Cz......................................#.1d.cellular.automata.....version.2.....2023.anmd.#......................................................
    .........zCo........dzT1111123456789abcdefghijklmnopqrstuv............................................................................................................
    ........yV3...Vy....xVa...............................................................................................................................................
    ..............3Ac.....................................................................................................................................................
    .............rVf....................Vr.............................Vr.............................Vr.............................Vr...................................
    ......................Vy..........1Xf............................1Xf............................1Xf............................1Xf....................................
    ........Vc..........3A3Y3A1.......Vx.............................Vx.............................Vx.............................Vx.....................................
    .Vr...1Xo..........nV6.mV4........af3Q...........................af3Q...........................af3Q...........................af3Q...................................
    .fBb.1X..........................4M...Y.........................4M...Y.........................4M...Y.........................4M...Y..................................
    ..4YY4Io............Vc..........1X0.J..J.......................1X0.J..J.......................1X0.J..J.......................1X0.J..J.................................
    ....4A4......Vr...1Xo........Vx..42M...J....................Vx..42M...J....................Vx..42M...J....................Vx..42M...J.................................
    ...wV8.......fBb.1X.......92Xa9..0A0...J.................92Xa9..0A0...J.................92Xa9..0A0...J.................92Xa9..0A0...J.................................
    ..............4YY4Io.........Vw...0YY0A.....................Vw...0YY0A.....................Vw...0YY0A.....................Vw...0YY0A..................................
    ................2A4.......a0X8........08T.1.11.1.........a0X8........08T.1.11.1.........a0X8........08T.1.11.1.........a0X8........08T.1.11.1.........................
    ...............oV6...................a8X............................a8X............................a8X............................a8X.................Vo..............
    .....................................Vm.............................................................................................Vn.............20X6.3O............
    .........................42O...Vo.20X4t2O..................2O........t2O..................2O........t2O..................2O........t6O................c6X.............
    ........................z.X...76O.....4X.................x.X..........X.................x.X..........X.................x.X..........X.................................
    #.INTERESTING.AUTOMATA.....#...#.l.....rL.......x.............l........r.......x.............l........r.......x.............l........r.......x.............l.......Rl#
    #.124:.#..11111.#..........#...#...0.#...............................1...1.......................................................1...1................................
    #.110:.#.111.11.#..........#...#...1.#..............................1.1.1.1.....................................................1.1.1.1...............................
    #.102:.#.11..11.#..........#...#...2.#.............................1.......1...................................................1.......1..............................
    #..90:.#.1.11.1.#..........#...#...3.#............................1.1.....1.1.................................................1.1.....1.1.............................
    #..30:.#.1111...#..........#...#...4.#...............1...................1...1.......................................................1...1...........1...1...1...1....
    #..16:.#....1...#..........#...#...5.#..1.1.1.1.1.1.1.1.............................................................................................1.1.1.1.1.1.1.1.1.
    #...2:.#.1......#..........#...#...6.#.................1...........................................................................................1..................
    #..........................#...#...7.#................1.1.........................................................................................1.1.................
    #.enter.code.into.Ts.above.#...#...8.#...............1...1.......................................................................................1...1................
    ...............................#...9.#..............1.1.1.1.....................................................................................1.1.1.1...............
    #.VARIABLES................#...#...a.#.............1.......1...................................................................................1.......1..............
    #.o:.number.of.rows..const.#...#...b.#............1.1.....1.1.................................................................................1.1.....1.1.............
    #.x:.read.and.write.column.#...#...c.#...........1...1...1...1...............................................................................1...1...1...1............
    #.y:.raw.row.counter.......#...#...d.#..........1.1.1.1.1.1.1.1.............................................................................1.1.1.1.1.1.1.1...........
    #..........................#...#...e.#.........1...............1...........................................................................1...............1..........
    #.m:.r2l.wrap.read.row.....#...#...f.#........1.1.............1.1.........................................................................1.1.............1.1.........
    #.n:.r2l.wrap.write.row....#...#...g.#.......1...1...........1...1.......................................................................1...1...........1...1........
    #.o:.l2r.wrap.row.counter..#...#...h.#......1.1.1.1.........1.1.1.1.....................................................................1.1.1.1.........1.1.1.1.......
    #..........................#...#...i.#.....1.......1.......1.......1...................................................................1.......1.......1.......1......
    #.r:.read.row.counter......#...#...j.#....1.1.....1.1.....1.1.....1.1.................................................................1.1.....1.1.....1.1.....1.1.....
    #.w:.write.row.counter.....#...#...k.#...1...1...1...1...1...1...1...1...............................................................1...1...1...1...1...1...1...1....
    ...............................#...l.#..1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.............................................................1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.
    ...............................#...m.#.................................1...........................................................1..................................
    ...............................#...n.#................................1.1.........................................................1.1.................................
    ......................................................................................................................................................................

Links

[1] my initial article on cellular automata in ORCΛ
ORCΛ thread in the lines community forums
ORCΛ on Hundred Rabbits' internet page

---

see all my articles