There's also an implementation at
https://rosettacode.org/wiki/One-dimensional_cellular_automata#J
9 Rule 30] 0=i:9
_________#_________
________###________
_______##__#_______
______##_####______
_____##__#___#_____
____##_####_###____
___##__#____#__#___
__##_####__######__
_##__#___###_____#_
Or, if it's rewritten:
Rule=:1 :0 NB. , x: number of generations, m: rule number, y: start state
:
'_#'{~ (3 ((|.m#:~8#2) {~ #.)\ 0,],0:)^:(i.x) y
)
(30 Rule =&0@i:)9
_________#_________
________###________
_______##__#_______
______##_####______
_____##__#___#_____
____##_####_###____
___##__#____#__#___
__##_####__######__
_##__#___###_____#_
Thanks,
--
Raul
On Fri, Oct 4, 2019 at 11:19 AM 'Mike Day' via Programming
<[email protected]> wrote:
>
> I haven't got around to re-programming this.
>
> FWIW, I think I tried years ago, probably in APL, I suppose when he
> first
> aired these automata.
>
> I'm pretty sure I modelled the general case, of which case 30 is an
> instance.
> The general case is for an arbitrary number in [0,255];
> The binary representation of 30 is 00011110 ...
>
> Cheers,
>
> Mike
>
>
> On 04/10/2019 14:26, 'Rob Hodgkinson' via Programming wrote:
> > Oops, lost my 1 char indent in each function (addrow, view, diagonal) but
> > should still copy/run…/Rob
> >
> >> On 4 Oct 2019, at 11:23 pm, 'Rob Hodgkinson' via Programming
> >> <[email protected]> wrote:
> >>
> >> Hey R.E.
> >>
> >> Nobody really picked this up, but I experimented for a little and produced
> >> this code to produce the Wolfram 30 puzzle, thought it might be useful for
> >> anyone wanting to explore.
> >> Turns out to be a nice use case for 3 u;._3 to extract length 3 subsets
> >> from a list as in a tessellation …
> >>
> >> The following can be pasted into a script (careful of quotes copying in
> >> here):
> >>
> >> =====================================================================
> >> load 'viewmat'
> >>
> >> NB. Wolfram’s 8 match cases for the existing row
> >> NB. NB. Convert each match case in base 2 (eg 1 1 1) to an integer (eg 7)
> >> as this is then faster to look up in addrow
> >> cases=: #.8 3$1 1 1, 1 1 0, 1 0 1, 1 0 0, 0 1 1, 0 1 0, 0 0 1, 0 0 0
> >> value=: 0 0 0 1 1 1 1 0
> >>
> >> addrow=: 3 : 0
> >> lastrow=. ,>_1 {. y
> >> NB. Calculate the #. of length 3 subarrays from the lastrow, then look up
> >> in cases and return corresponding value to create newrow
> >> newrow=. value {~ cases i. 3 #.;._3] 0 0,lastrow,0 0
> >> y,<newrow
> >> )
> >>
> >> view=:3 : 0
> >> (|.-i.1{.$ mat)|."0 1 mat=:>y
> >> )
> >>
> >> diagonal =:3 : 0
> >> (<0 1)|: y NB. Return diagonal of matrix y
> >> )
> >>
> >> smoutput 'To run for example ...'
> >> smoutput ' viewmat view addrow^:50 <1'
> >> =====================================================================
> >>
> >> So the sample line above:
> >>
> >> viewmat view addrow^:50 <1
> >>
> >> reproduces the graphic triangle shown in the first link you gave below …
> >>
> >> I did not spend much time on analysing the centre column (which in my case
> >> as I maintain each row as a list, may be found using diagonal as here;
> >>
> >> diagonal >addrow^:6 <1
> >> 1 1 0 1 1 1 0
> >>
> >> Hope others find this useful.
> >>
> >> @Cliff Reiter: maybe even scope to consider as another chaotic instance as
> >> Woflram suggest…/Rob
> >>
> >>> On 2 Oct 2019, at 6:49 pm, R.E. Boss <[email protected]> wrote:
> >>>
> >>> This was submitted in math-fun
> >>>
> >>> https://rule30prize.org
> >>> https://writings.stephenwolfram.com/2019/10/announcing-the-rule-30-prizes
> >>>
> >>>
> >>> R.E. Boss
> >>> ----------------------------------------------------------------------
> >>> For information about J forums see http://www.jsoftware.com/forums.htm
> >> ----------------------------------------------------------------------
> >> For information about J forums see http://www.jsoftware.com/forums.htm
> > ----------------------------------------------------------------------
> > For information about J forums see http://www.jsoftware.com/forums.htm
>
>
> --
> This email has been checked for viruses by Avast antivirus software.
> https://www.avast.com/antivirus
>
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm