How to resolve the algorithm Elementary cellular automaton/Infinite length step by step in the J programming language

Published on 12 May 2024 09:40 PM
#J

How to resolve the algorithm Elementary cellular automaton/Infinite length step by step in the J programming language

Table of Contents

Problem Statement

The purpose of this task is to create a version of an Elementary cellular automaton whose number of cells is only limited by the memory size of the computer. To be precise, consider the state of the automaton to be made of an infinite number of cells, but with a bounded support. In other words, to describe the state of the automaton, you need a finite number of adjacent cells, along with their individual state, and you then consider that the individual state of each of all other cells is the negation of the closest individual cell among the previously defined finite number of cells. Examples: More complex methods can be imagined, provided it is possible to somehow encode the infinite sections. But for this task we will stick to this simple version.

Let's start with the solution:

Step by Step solution about How to resolve the algorithm Elementary cellular automaton/Infinite length step by step in the J programming language

Source code in the j programming language

ext9=: (9#1-{.!.1),],9#1-{:!.1
trim=: |.@(}.~ ] i. 1-{.)^:2
next=: trim@(((8$2) #: [) {~ 2 #. 1 - [: |: |.~"1 0&_1 0 1@]) ext9


   ' *'{~90 next^:(i.9) 1
*                
* *              
*   *            
* * * *          
*       *        
* *     * *      
*   *   *   *    
* * * * * * * *  
*               *


  

You may also check:How to resolve the algorithm Palindrome detection step by step in the NetRexx programming language
You may also check:How to resolve the algorithm Strip a set of characters from a string step by step in the Nemerle programming language
You may also check:How to resolve the algorithm Abbreviations, simple step by step in the FutureBasic programming language
You may also check:How to resolve the algorithm OpenWebNet password step by step in the Java programming language
You may also check:How to resolve the algorithm Successive prime differences step by step in the 11l programming language