1
<?php $fb_user = $facebook->require_add(); ?>
3
<script language="javascript">
10
var grid = new Array(max_y)
15
for (i=0; i<=max_y; i++) { grid[i] = new Array(max_x)
17
for (cy=0; cy<=max_y; cy++) { for (cx=0; cx<=max_x; cx++) { grid[cy][cx] = 0
18
html = html+"<div id='x"+cx+"y"+cy+"' style='position:absolute; top:"+cy*sq+"px; left:"+cx*sq+"px; width:"+sq2+"px; height:"+sq2+"px; z-index:1; background-color:#FFFFFF'></div>"
21
function MoveSnake() { document.getElementById("grid").style.top = y*sq
22
document.getElementById("grid").style.left = x*sq
24
function odd(value) { var binary = value.toString(2); if (binary.charAt(binary.length - 1) == "1") { return false;}
27
function Logic() { if (grid[y][x] == 0) { grid[y][x] = 1
29
document.getElementById(id).style.backgroundColor = "#000000"
30
if (counter == 0) {movy = -1; movx = 0}
31
if (movy == -1) { movy = 0; movx = -1
32
} else { if (movx == -1) { movx = 0; movy = 1
33
} else { if (movy == 1) { movx = 1; movy = 0
34
} else { if (movx == 1) { movx = 0; movy = -1
41
} else { grid[y][x] = 0
43
document.getElementById(id).style.backgroundColor = "#3B5998"
44
if (movy == -1) { movy = 0; movx = 1
45
} else { if (movx == -1) { movx = 0; movy = -1
46
} else { if (movy == 1) { movx = -1; movy = 0
47
} else { if (movx == 1) { movx = 0; movy = 1
57
document.form1.counter.value = counter
59
html = html+"<div id='grid' style='position:absolute; background-color:#000FFF; z-index:2; width:"+sq+"px; height:"+sq+"px;'></div>"
60
html = html+"<div style='position:absolute; top:"+sq2+"px; left:"+sq2+"px; z-index:2;'><form name='form1'><input id='counter' name='counter' type='text' value='0' style='font:Arial; font-size:12px; font-weight: bold; color:#000000; background-color:#0000000;'/></form></div>"
62
setInterval("Logic()",1)
66
<script src="http://www.google-analytics.com/urchin.js" type="text/javascript">
68
<script type="text/javascript">
69
_uacct = "UA-2645625-6";
97
<p>The experiment above consists of the following rules:</p>
98
<li> If the square is white/blue - move forward 1 space & rotate 90 degrees left. Reset.
99
<li> If the square is black - move forward 1 space & rotate 90 degrees right. Reset.
101
<p> It's amazing to that with just these simple rules such chaos can emerge.
102
<p> Watch carefully around the 10,000 mark.. something quite strange happens.