Anonymous user
Remote agent/Simulation/C: Difference between revisions
no edit summary
(bug fix) |
imported>Katsumi No edit summary |
||
(3 intermediate revisions by 2 users not shown) | |||
Line 3:
;<nowiki>server.c:</nowiki>
<syntaxhighlight lang="c" line>
#include <stdlib.h>
#include <unistd.h>
Line 131 ⟶ 132:
return 1;
}</
;<nowiki>client.c:</nowiki>
<syntaxhighlight lang="c" line>
#include <stdlib.h>
#include <unistd.h>
Line 406 ⟶ 408:
turn(c_cw), say(c_cw), hear();
try_forward(fd);
}
</syntaxhighlight>
;<nowiki>common.c:</nowiki>
<syntaxhighlight lang="c" line>
enum {
c_fwd, c_cw, c_ccw, c_get, c_drop, c_over, c_stop,
Line 420 ⟶ 424:
};
const char *cmds = "^><@!+.RGYBrgyb|SAsa";
inline int cmd_to_char(int c) { return cmds[c]; }
inline int char_to_cmd(int c) {
Line 551 ⟶ 555:
}
const char *colors[] = { "31", "32", "33", "34" };
const char *ag
inline int cell_color(byte **f, int x, int y)
Line 612 ⟶ 616:
if (dir == c_cw)
if (++agent.facing > 3) agent.facing = 0;
}
</syntaxhighlight>
|