Math::...rRule57(3pm)
π NAME π
Math::PlanePath::CellularRule57 β cellular automaton 57 and 99 points
okay so bestie, quick heads up before anything: this page is Math::...rRule57(3pm), from the User Contributed Perl Documentation collection. yes the title got truncated, she's just like that. π
β¨ SYNOPSIS β¨
use Math::PlanePath::CellularRule57;
my $path = Math::PlanePath::CellularRule57->new;
my ($x, $y) = $path->n_to_xy (123);
πΈ DESCRIPTION πΈ
So this is literally Stephen Wolfram's "rule 57" cellular automaton, laid out in rows:
<http://mathworld.wolfram.com/ElementaryCellularAutomaton.html>
51 52 53 54 55 56 10
38 39 40 41 42 43 44 45 46 47 48 49 50 9
33 34 35 36 37 8
23 24 25 26 27 28 29 30 31 32 7
19 20 21 22 6
12 13 14 15 16 17 18 5
9 10 11 4
5 6 7 8 3
3 4 2
2 1
1 <- Y=0
-9 -8 -7 -6 -5 -4 -3 -2 -1 X=0 1 2 3 4 5 6 7 8 9
The triangular numbers N=10,15,21,28,etc, k*(k+1)/2, make a 1/2 sloping diagonal upwards. iconic behavior honestly.
On rows with odd Y there's a solid block at either end, then 1 of 3 cells to the left and 2 of 3 to the right of the centre. On even Y rows there's a similar 1 of 3 and 2 of 3 middle parts, but without the solid ends. Those 1 of 3 and 2 of 3 are successively offset so as to make lines going up towards the centre, as you can see in the following plot:
*********** * * * * * ** ** ** ************
* * * * ** ** ** **
********** * * * * ** ** ** ***********
* * * * * ** ** **
********* * * * ** ** ** **********
* * * * ** ** **
******** * * * * ** ** *********
* * * ** ** **
******* * * * ** ** ********
* * * * ** **
****** * * ** ** *******
* * * ** **
***** * * * ** ******
* * ** **
**** * * ** *****
* * * **
*** * ** ****
* * **
** * * ***
* **
* * **
* *
*
*
π¦ Mirror
The mirror => 1 option gives the mirror image pattern, which is "rule 99". The point numbering shifts but the total points on each row is the same, no cap.
51 52 53 54 55 56 10
38 39 40 41 42 43 44 45 46 47 48 49 50 9
33 34 35 36 37 8
23 24 25 26 27 28 29 30 31 32 7
19 20 21 22 6
12 13 14 15 16 17 18 5
9 10 11 4
5 6 7 8 3
3 4 2
2 1
1 <- Y=0
-9 -8 -7 -6 -5 -4 -3 -2 -1 X=0 1 2 3 4 5 6 7 8 9
β¨ N Start
The default is to number points starting N=1 as shown above. An optional n_start can give a different start, in the same pattern. For example, to start at 0:
n_start => 0
22 23 24 25 26 27 28 29 30 31
18 19 20 21
11 12 13 14 15 16 17
8 9 10
4 5 6 7
2 3
1
0
π«Ά FUNCTIONS π«Ά
See "FUNCTIONS" in Math::PlanePath for behaviour common to all path classes, bestie. that's the shared lore.
$path = Math::PlanePath::CellularRule57->new ()$path = Math::PlanePath::CellularRule57->new (mirror => $bool, n_start => $n)β Create and return a new path object. π($x,$y) = $path->n_to_xy ($n)β Return the X,Y coordinates of point number$non the path.$n = $path->xy_to_n ($x,$y)β Return the point number for coordinates"$x,$y".$xand$yare each rounded to the nearest integer, which has the effect of treating each cell as a square of side 1. If"$x,$y"is outside the pyramid or on a skipped cell the return is"undef". π yeah she just says undef, no explanation, no apology.
π SEE ALSO π
Math::PlanePathMath::PlanePath::CellularRuleMath::PlanePath::CellularRule54Math::PlanePath::CellularRule190Math::PlanePath::PyramidRows
<http://mathworld.wolfram.com/ElementaryCellularAutomaton.html>
π HOME PAGE π
<http://user42.tuxfamily.org/math-planepath/index.html>
π LICENSE π
Copyright 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020 Kevin Ryde
This file is part of Math-PlanePath.
Math-PlanePath is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version.
Math-PlanePath is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with Math-PlanePath. If not, see <http://www.gnu.org/licenses/>.
and that's the whole page bestie!! π this one came from perl v5.32.0, dated 2021-01-23, filed under User Contributed Perl Documentation β go forth and plot ur little triangles, no cap π¦β¨
π¦ where this page comes from
- debian bookworm: libmath-planepath-perl 129-1 Β· GPL-3.0-or-later
- debian trixie: libmath-planepath-perl 129-1 Β· GPL-3.0-or-later
- ubuntu jammy: libmath-planepath-perl 129-1 Β· GPL-3.0-or-later
- ubuntu noble: libmath-planepath-perl 129-1 Β· GPL-3.0-or-later
- ubuntu resolute: libmath-planepath-perl 129-1 Β· GPL-3.0-or-later
- ubuntu stonking: libmath-planepath-perl 129-1 Β· GPL-3.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms