https://codepen.io/anon/pen/vvqNqg
These rule makes mysterious path!
Another ant-based cellular automata
- PHPBB12345
- Posts: 1096
- Joined: August 5th, 2015, 11:55 pm
- Contact:
- Redstoneboi
- Posts: 429
- Joined: May 14th, 2018, 3:57 am
Re: Another ant-based cellular automata
the step function:
declarations:
after analysis, the rule seems to:
write down the next position as cx and cy,
change the direction similar to langton's ant,
toggle the cell at cx and cy,
move to cx and cy,
repeat.
simplification leaves this:
flip cell,
change direction according to cell behind,
move forward,
repeat.
which is basically:
langton's ant but it looks behind instead of under.
Code: Select all
function next_step()
{
var dx = x_shift[ant_d];
var dy = y_shift[ant_d];
var cx = (ant_x+dx+w)%w;
var cy = (ant_y+dy+h)%h;
var a = cy*w+cx;
var s = currc[a];
if (s)
ant_d = (ant_d + 3) % 4
else
ant_d = (ant_d + 1) % 4
currc[ant_y*w+ant_x] = 1 - s;
ant_x = cx;
ant_y = cy;
Code: Select all
var ant_x = (w / 2) | 0;
var ant_y = (h / 2) | 0;
var ant_d = 0;
var currc = new Uint8Array(w*h);
var x_shift = [1,0,-1,0];
var y_shift = [0,1,0,-1];
write down the next position as cx and cy,
change the direction similar to langton's ant,
toggle the cell at cx and cy,
move to cx and cy,
repeat.
simplification leaves this:
flip cell,
change direction according to cell behind,
move forward,
repeat.
which is basically:
langton's ant but it looks behind instead of under.
c(>^w^<c)~*
This is 「Fluffy」
「Fluffy」is my sutando.
「Fluffy」has the ability to engineer r e p l i c a t o r s.
「Fluffy」likes to watch spaceship guns in Golly.
「Fluffy」knows Natsuki best girl.
This is 「Fluffy」
「Fluffy」is my sutando.
「Fluffy」has the ability to engineer r e p l i c a t o r s.
「Fluffy」likes to watch spaceship guns in Golly.
「Fluffy」knows Natsuki best girl.