1D cellular automaton?

A forum for topics that don't fit elsewhere. Introduce yourselves to other members of the forums, discuss how your name evolves when written out in the Game of Life, or just tell us how you found it. Forum rules still apply.
Locked
User avatar
PHPBB12345
Posts: 1150
Joined: August 5th, 2015, 11:55 pm
Contact:

1D cellular automaton?

Post by PHPBB12345 »

pow_img1.png
pow_img1.png (27.38 KiB) Viewed 2516 times
pow_img2.png
pow_img2.png (29.49 KiB) Viewed 2516 times
pow_img3.png
pow_img3.png (38.24 KiB) Viewed 2516 times
User avatar
PHPBB12345
Posts: 1150
Joined: August 5th, 2015, 11:55 pm
Contact:

Re: 1D cellular automaton?

Post by PHPBB12345 »

pow_img4.png
pow_img4.png (56.62 KiB) Viewed 2514 times
pow_img5.png
pow_img5.png (89.73 KiB) Viewed 2514 times
pow_img6.png
pow_img6.png (102.46 KiB) Viewed 2514 times
User avatar
PHPBB12345
Posts: 1150
Joined: August 5th, 2015, 11:55 pm
Contact:

Re: 1D cellular automaton?

Post by PHPBB12345 »

HTML Code:

Code: Select all

<canvas id="c" width="1024" height="1024"></canvas>
<script>
var can = document.getElementById("c")
var ctx = can.getContext("2d");
var clist = ["#FFFFFF", "#999999", "#000000"];
var step = 256, v1 = 3, v2 = 2;
var stepm1 = step - 1;
var size = 1024 / step

var a = [];
for (var i = 0; i < stepm1; i++) a[i] = 0;
a[stepm1] = 1;
var b, k, m;

for (m = 0; m < step; m++) {

for (var i = 0; i < step; i++) {
   ctx.fillStyle = clist[a[i]];
   ctx.fillRect(size*i, size*m, size, size)
}

b = [];
for (var i = 0; i < stepm1; i++) b[i] = a[i + 1] + a[i] * v2;
b[stepm1] = a[stepm1] * v2;

for (var i = stepm1; i > 0; i--) {
   k = Math.floor(b[i] / v1);
   b[i] -= k * v1;
   b[i - 1] -= k * v2;
}
b[0] = (b[0] % v1 + v1) % v1;
a = b;

}

</script>
http://pan.baidu.com/s/1c1JLc0C
Last edited by PHPBB12345 on June 11th, 2019, 9:13 pm, edited 1 time in total.
User avatar
Saka
Posts: 3626
Joined: June 19th, 2015, 8:50 pm
Location: Indonesia
Contact:

Re: 1D cellular automaton?

Post by Saka »

Wolfram?
jarring cyan
Locked