Jump to content

Remote agent/Simulation/C: Difference between revisions

m
formatting
m (Use {{collection}}, not {{implementation}}.)
m (formatting)
Line 1:
<noinclude>{{collection|Remote agent/Simulation}}</noinclude>
Server/client programs share a lot of code, so they are all lumped together here. To compile, dump all three files in the same dir, and compile server.c and client.c separately. The server binds to port 11111. Both server and client display the current map, though only the server has the whole world, the client only knows cells the agent has been to.
 
;<nowiki>server.c:</nowiki>
<lang c>#include <stdio.h>
#include <stdlib.h>
Line 133:
}</lang>
 
;<nowiki>client.c:</nowiki>
<lang c>#include <stdio.h>
#include <stdlib.h>
Line 407:
}</lang>
 
and share source ";<nowiki>common.c":</nowiki>
<lang c>struct agent_t{ int x, y, facing, ball; } agent = { 0, 0, 0, -1 };
enum {
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.