Another ant-based cellular automata

A forum where anything goes. 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. This is the forum for "non-academic" content.
Post Reply
User avatar
PHPBB12345
Posts: 1096
Joined: August 5th, 2015, 11:55 pm
Contact:

Another ant-based cellular automata

Post by PHPBB12345 » January 18th, 2019, 2:28 am

https://codepen.io/anon/pen/vvqNqg
These rule makes mysterious path!

User avatar
Redstoneboi
Posts: 429
Joined: May 14th, 2018, 3:57 am

Re: Another ant-based cellular automata

Post by Redstoneboi » January 27th, 2019, 2:08 am

the step function:

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;
declarations:

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];
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.
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.

Post Reply