Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
33
Task/Langtons-ant/Aime/langtons-ant.aime
Normal file
33
Task/Langtons-ant/Aime/langtons-ant.aime
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
void
|
||||
ant(integer x, y, d, list map)
|
||||
{
|
||||
while (-1 < x && x < 100 && -1 < y && y < 100) {
|
||||
integer e, p, w;
|
||||
data b;
|
||||
|
||||
b = map[y];
|
||||
w = b[x >> 3];
|
||||
p = 1 << (7 - (x & 7));
|
||||
b[x >> 3] = w ^ p;
|
||||
|
||||
d += w & p ? 1 : 3;
|
||||
|
||||
e = d & 1;
|
||||
set(e, $e + ((d & 2) - 1) * (2 * e - 1));
|
||||
}
|
||||
}
|
||||
|
||||
integer
|
||||
main(void)
|
||||
{
|
||||
file f;
|
||||
list l;
|
||||
|
||||
call_n(100, lb_p_data, l, data().run(13, 0));
|
||||
ant(50, 50, 2, l);
|
||||
|
||||
f.create("ant.pbm", 00644).text("P4\n100 100\n");
|
||||
l.ucall(f_data, 1, f);
|
||||
|
||||
0;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue