e93d25114c8955dc3e97107ed1a5e68a3ea0bbe3
[progcomp10.git] / src / link / C / README.txt
1 Welcome to the C SDK and link library.
2
3 If you want to enter in C, you've come to the right place.
4
5 == Compiling and watching the sample bots in 2 easy steps ==
6
7 Run "make" in this directory. [NB: this document assumes you use Linux 
8 or Mac OS X. If you use Windows, see WINDOWS.txt for instructions.]
9
10 Go to the src/ directory and run "./simulate.py -v -a CSampleAgents".
11
12 == Making your own agent with C in 11 easy steps ==
13
14 0. Flick through the documentation.
15
16 1. Pick a name for your agent. Make sure the name is a valid identifier 
17 in both C and Python. Be original. Names do *not* have to be prefixed 
18 with "c_"
19
20 2. Flick through the sample agents in the agents directory.  Pick a 
21 sample agent to copy-paste (so you don't have to type out the function 
22 definitions).
23
24 3. Copy the sample agent code into a new file in the "agents" directory. 
25 Make sure the file name matches the new agent name. The makefile will 
26 automatically compile your new agent when you run "make".
27
28 4. Create a python wrapper for your agent, by copying one of the sample 
29 agent definitions in c_agents.py and using the name of your agent.
30
31 5. Create an arena in which your agent can battle:
32
33    5.1. open arenas/MyArena.py
34
35    5.2. add "from link.C.c_agents import <youragentname>"
36
37    5.3. modify the "Agents =" line to include your agent, and take out 
38 any agents you don't want to battle.
39
40    5.4. to see how to import the C sample agents, see CSampleAgents.py.
41
42 6. Watch your agent in action: ./simulate -v -a MyArena
43
44 7. Oh no, my agent dies very quickly: what's going on?
45
46    7.1 insert debugmsg() statements in your C program.
47         
48         7.1.1 debugmsg() is like printf - see c_link.h for an example.
49
50         7.1.2 in Initialise(), save the name that's passed to you so 
51 that you can uniquely identify your agent when you're printing debug 
52 statements.
53
54    7.2 Run "./simulate -v -n 1 -a MyArena" to start with only 1 of each 
55 agent.
56
57    7.3 Change the agents against which you're battling in MyArena.py so 
58 that you have a predictable opponent.
59
60    7.4 Edit conf.py, and set DEBUG=True. Don't forget to reset it when 
61 you're done.
62
63    7.5 Read doc/UNSUPPORTED.txt to see how to interact directly with 
64 your agent. You can then invoke your agent from the command line 
65 (for example "./link/C/agents/c_angel") and see how it responds.
66
67 8. Once your agent works to your satisfaction, try it both on short and 
68 long durations (100 and 1000 rounds: see MAX_ITERATIONS in conf.py)
69
70 9. If the rolling scoreboard has been opened on progcomp.ucc.asn.au/, 
71 submit it there! Otherwise, sit tight.
72
73 10. Watch its progress on the scoreboard and adjust your strategy 
74 accordingly.
75
76 === OTHER IMPORTANT NOTES ===
77
78  * Static storage *is* *considered* *cheating*. You must *not* attempt 
79 to communicate between instances of your agent in any way other than by 
80 sequences of moves.
81
82  * Obfuscated code is bad. Don't do it.

UCC git Repository :: git.ucc.asn.au