How to resolve the algorithm One-dimensional cellular automata step by step in the PicoLisp programming language

Published on 12 May 2024 09:40 PM

How to resolve the algorithm One-dimensional cellular automata step by step in the PicoLisp programming language

Table of Contents

Problem Statement

Assume an array of cells with an initial distribution of live and dead cells, and imaginary cells off the end of the array having fixed values. Cells in the next generation of the array are calculated based on the value of the cell and its left and right nearest neighbours in the current generation. If, in the following table, a live cell is represented by 1 and a dead cell by 0 then to generate the value of the cell at a particular index in the array of cellular values you use the following table:

Let's start with the solution:

Step by Step solution about How to resolve the algorithm One-dimensional cellular automata step by step in the PicoLisp programming language

Source code in the picolisp programming language

(let Cells (chop "_###_##_#_#_#_#__#__")
   (do 10
      (prinl Cells)
      (setq Cells
         (make
            (link "_")
            (map
               '((L)
                  (case (head 3 L)
                     (`(mapcar chop '("___" "__#" "_#_" "#__" "###"))
                         (link "_") )
                     (`(mapcar chop '("_##" "#_#" "##_"))
                        (link "#") ) ) )
               Cells )
            (link "_") ) ) ) )

  

You may also check:How to resolve the algorithm Greedy algorithm for Egyptian fractions step by step in the PARI/GP programming language
You may also check:How to resolve the algorithm Textonyms step by step in the Io programming language
You may also check:How to resolve the algorithm Arithmetic/Integer step by step in the ML/I programming language
You may also check:How to resolve the algorithm Voronoi diagram step by step in the Mathematica/Wolfram Language programming language
You may also check:How to resolve the algorithm Nested function step by step in the C++ programming language