1Math::PlanePath::CellulUasreRrulCeo5n7t(r3i)buted Perl DMoactuhm:e:nPtlaatnieoPnath::CellularRule57(3)
2
3
4
6 Math::PlanePath::CellularRule57 -- cellular automaton 57 and 99 points
7
9 use Math::PlanePath::CellularRule57;
10 my $path = Math::PlanePath::CellularRule57->new;
11 my ($x, $y) = $path->n_to_xy (123);
12
14 This is the pattern of Stephen Wolfram's "rule 57" cellular automaton
15
16 <http://mathworld.wolfram.com/ElementaryCellularAutomaton.html>
17
18 arranged as rows
19
20 51 52 53 54 55 56 10
21 38 39 40 41 42 43 44 45 46 47 48 49 50 9
22 33 34 35 36 37 8
23 23 24 25 26 27 28 29 30 31 32 7
24 19 20 21 22 6
25 12 13 14 15 16 17 18 5
26 9 10 11 4
27 5 6 7 8 3
28 3 4 2
29 2 1
30 1 <- Y=0
31
32 -9 -8 -7 -6 -5 -4 -3 -2 -1 X=0 1 2 3 4 5 6 7 8 9
33
34 The triangular numbers N=10,15,21,28,etc, k*(k+1)/2, make a 1/2 sloping
35 diagonal upwards.
36
37 On rows with odd Y there's a solid block at either end then 1 of 3
38 cells to the left and 2 of 3 to the right of the centre. On even Y
39 rows there's similar 1 of 3 and 2 of 3 middle parts, but without the
40 solid ends. Those 1 of 3 and 2 of 3 are successively offset so as to
41 make lines going up towards the centre as can be seen in the following
42 plot.
43
44 *********** * * * * * ** ** ** ************
45 * * * * ** ** ** **
46 ********** * * * * ** ** ** ***********
47 * * * * * ** ** **
48 ********* * * * ** ** ** **********
49 * * * * ** ** **
50 ******** * * * * ** ** *********
51 * * * ** ** **
52 ******* * * * ** ** ********
53 * * * * ** **
54 ****** * * ** ** *******
55 * * * ** **
56 ***** * * * ** ******
57 * * ** **
58 **** * * ** *****
59 * * * **
60 *** * ** ****
61 * * **
62 ** * * ***
63 * **
64 * * **
65 * *
66 *
67 *
68
69 Mirror
70 The "mirror => 1" option gives the mirror image pattern which is "rule
71 99". The point numbering shifts but the total points on each row is
72 the same.
73
74 51 52 53 54 55 56 10
75 38 39 40 41 42 43 44 45 46 47 48 49 50 9
76 33 34 35 36 37 8
77 23 24 25 26 27 28 29 30 31 32 7
78 19 20 21 22 6
79 12 13 14 15 16 17 18 5
80 9 10 11 4
81 5 6 7 8 3
82 3 4 2
83 2 1
84 1 <- Y=0
85
86 -9 -8 -7 -6 -5 -4 -3 -2 -1 X=0 1 2 3 4 5 6 7 8 9
87
88 N Start
89 The default is to number points starting N=1 as shown above. An
90 optional "n_start" can give a different start, in the same pattern.
91 For example to start at 0,
92
93 n_start => 0
94
95 22 23 24 25 26 27 28 29 30 31
96 18 19 20 21
97 11 12 13 14 15 16 17
98 8 9 10
99 4 5 6 7
100 2 3
101 1
102 0
103
105 See "FUNCTIONS" in Math::PlanePath for behaviour common to all path
106 classes.
107
108 "$path = Math::PlanePath::CellularRule57->new ()"
109 "$path = Math::PlanePath::CellularRule57->new (mirror => $bool, n_start
110 => $n)"
111 Create and return a new path object.
112
113 "($x,$y) = $path->n_to_xy ($n)"
114 Return the X,Y coordinates of point number $n on the path.
115
116 "$n = $path->xy_to_n ($x,$y)"
117 Return the point number for coordinates "$x,$y". $x and $y are
118 each rounded to the nearest integer, which has the effect of
119 treating each cell as a square of side 1. If "$x,$y" is outside
120 the pyramid or on a skipped cell the return is "undef".
121
123 Math::PlanePath, Math::PlanePath::CellularRule,
124 Math::PlanePath::CellularRule54, Math::PlanePath::CellularRule190,
125 Math::PlanePath::PyramidRows
126
127 <http://mathworld.wolfram.com/ElementaryCellularAutomaton.html>
128
130 <http://user42.tuxfamily.org/math-planepath/index.html>
131
133 Copyright 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018 Kevin Ryde
134
135 This file is part of Math-PlanePath.
136
137 Math-PlanePath is free software; you can redistribute it and/or modify
138 it under the terms of the GNU General Public License as published by
139 the Free Software Foundation; either version 3, or (at your option) any
140 later version.
141
142 Math-PlanePath is distributed in the hope that it will be useful, but
143 WITHOUT ANY WARRANTY; without even the implied warranty of
144 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
145 General Public License for more details.
146
147 You should have received a copy of the GNU General Public License along
148 with Math-PlanePath. If not, see <http://www.gnu.org/licenses/>.
149
150
151
152perl v5.30.1 2020-01-30Math::PlanePath::CellularRule57(3)