June 2018 Update
This commit is contained in:
parent
ba8067c3b7
commit
22f33d4004
5278 changed files with 84726 additions and 14379 deletions
|
|
@ -4,25 +4,20 @@ is_white(list map, integer x, integer y)
|
|||
integer p, w;
|
||||
data b;
|
||||
|
||||
b = l_q_data(map, y);
|
||||
w = b_character(b, x >> 3);
|
||||
b = map[y];
|
||||
w = b[x >> 3];
|
||||
p = 1 << (7 - (x & 7));
|
||||
b_replace(b, x >> 3, w ^ p);
|
||||
b[x >> 3] = w ^ p;
|
||||
|
||||
return !(w & p);
|
||||
!(w & p);
|
||||
}
|
||||
|
||||
void
|
||||
ant(integer x, integer y, integer d, list map)
|
||||
{
|
||||
while (-1 < x && x < 100 && -1 < y && y < 100) {
|
||||
if (is_white(map, x, y)) {
|
||||
d += 3;
|
||||
d &= 3;
|
||||
} else {
|
||||
d += 1;
|
||||
d &= 3;
|
||||
}
|
||||
d += is_white(map, x, y) ? 3 : 1;
|
||||
d &= 3;
|
||||
|
||||
if (d & 1) {
|
||||
y += (d & 2) - 1;
|
||||
|
|
@ -41,29 +36,16 @@ main(void)
|
|||
|
||||
i = 100;
|
||||
while (i) {
|
||||
data b;
|
||||
integer j;
|
||||
|
||||
i -= 1;
|
||||
j = 13;
|
||||
while (j) {
|
||||
j -= 1;
|
||||
b_append(b, 0);
|
||||
}
|
||||
|
||||
l_l_data(l, -1, b);
|
||||
l_n_data(l, -1).run(13, 0);
|
||||
}
|
||||
|
||||
ant(50, 50, 2, l);
|
||||
|
||||
f_open(f, "ant.pbm", OPEN_CREATE | OPEN_TRUNCATE | OPEN_WRITEONLY, 00644);
|
||||
f.create("ant.pbm", 00644);
|
||||
|
||||
f_text(f, "P4\n100 100\n");
|
||||
i = 100;
|
||||
while (i) {
|
||||
f_b_post(f, l_q_data(l, -i));
|
||||
i -= 1;
|
||||
}
|
||||
f.text("P4\n100 100\n");
|
||||
l.ucall(f_data, 1, f);
|
||||
|
||||
return 0;
|
||||
0;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue