C documentation
authorDaniel Axtens <[email protected]>
Tue, 14 Sep 2010 14:59:24 +0000 (22:59 +0800)
committerDaniel Axtens <[email protected]>
Tue, 14 Sep 2010 15:01:53 +0000 (23:01 +0800)
src/link/C/README [deleted file]
src/link/C/README.txt [new file with mode: 0644]
src/link/C/WINDOWS.txt [new file with mode: 0644]
src/link/C/c_agents.py

diff --git a/src/link/C/README b/src/link/C/README
deleted file mode 100644 (file)
index ad894a7..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-Welcome to the C SDK and link library.
-
-If you want to enter in C, you've come to the right place.
-
-== Compiling and testing the sample bots ==
-
-Run "make" in this directory. To include them in the 
-
-== Making your own agent ==
-See wiki page.
-
-Also, use the link/bundle-agent.sh shell script - it will take your agent file
-and make a python module that you can include.
-
-= Testing your own agent =
-Edit src/simulate.py.
-Your agents live in link.C.c_agents
-Add them to Agents to get them to do battle.
-
-For example, this code imports c_angel, c_lucifer, c_streetfighter and
-c_wash, as well as the python sample agents, and then battles c_lucifer, 
-python Wash, c_streetfighter and c_angel. It goes at the top of simulate.py.
-
-# Import and add your agents here:
-from link.C.c_agents import c_angel, c_lucifer, c_streetfighter, c_wash
-
-from SampleAgents import Angel, Lucifer, Dummy, Wash, Streetfighter
-Agents = [c_lucifer, Wash, c_streetfighter, c_angel]
-
diff --git a/src/link/C/README.txt b/src/link/C/README.txt
new file mode 100644 (file)
index 0000000..e93d251
--- /dev/null
@@ -0,0 +1,82 @@
+Welcome to the C SDK and link library.
+
+If you want to enter in C, you've come to the right place.
+
+== Compiling and watching the sample bots in 2 easy steps ==
+
+Run "make" in this directory. [NB: this document assumes you use Linux 
+or Mac OS X. If you use Windows, see WINDOWS.txt for instructions.]
+
+Go to the src/ directory and run "./simulate.py -v -a CSampleAgents".
+
+== Making your own agent with C in 11 easy steps ==
+
+0. Flick through the documentation.
+
+1. Pick a name for your agent. Make sure the name is a valid identifier 
+in both C and Python. Be original. Names do *not* have to be prefixed 
+with "c_"
+
+2. Flick through the sample agents in the agents directory.  Pick a 
+sample agent to copy-paste (so you don't have to type out the function 
+definitions).
+
+3. Copy the sample agent code into a new file in the "agents" directory. 
+Make sure the file name matches the new agent name. The makefile will 
+automatically compile your new agent when you run "make".
+
+4. Create a python wrapper for your agent, by copying one of the sample 
+agent definitions in c_agents.py and using the name of your agent.
+
+5. Create an arena in which your agent can battle:
+
+   5.1. open arenas/MyArena.py
+
+   5.2. add "from link.C.c_agents import <youragentname>"
+
+   5.3. modify the "Agents =" line to include your agent, and take out 
+any agents you don't want to battle.
+
+   5.4. to see how to import the C sample agents, see CSampleAgents.py.
+
+6. Watch your agent in action: ./simulate -v -a MyArena
+
+7. Oh no, my agent dies very quickly: what's going on?
+
+   7.1 insert debugmsg() statements in your C program.
+        
+        7.1.1 debugmsg() is like printf - see c_link.h for an example.
+
+        7.1.2 in Initialise(), save the name that's passed to you so 
+that you can uniquely identify your agent when you're printing debug 
+statements.
+
+   7.2 Run "./simulate -v -n 1 -a MyArena" to start with only 1 of each 
+agent.
+
+   7.3 Change the agents against which you're battling in MyArena.py so 
+that you have a predictable opponent.
+
+   7.4 Edit conf.py, and set DEBUG=True. Don't forget to reset it when 
+you're done.
+
+   7.5 Read doc/UNSUPPORTED.txt to see how to interact directly with 
+your agent. You can then invoke your agent from the command line 
+(for example "./link/C/agents/c_angel") and see how it responds.
+
+8. Once your agent works to your satisfaction, try it both on short and 
+long durations (100 and 1000 rounds: see MAX_ITERATIONS in conf.py)
+
+9. If the rolling scoreboard has been opened on progcomp.ucc.asn.au/, 
+submit it there! Otherwise, sit tight.
+
+10. Watch its progress on the scoreboard and adjust your strategy 
+accordingly.
+
+=== OTHER IMPORTANT NOTES ===
+
+ * Static storage *is* *considered* *cheating*. You must *not* attempt 
+to communicate between instances of your agent in any way other than by 
+sequences of moves.
+
+ * Obfuscated code is bad. Don't do it.
diff --git a/src/link/C/WINDOWS.txt b/src/link/C/WINDOWS.txt
new file mode 100644 (file)
index 0000000..d167e2b
--- /dev/null
@@ -0,0 +1,38 @@
+WINDOWS.txt: Notes towards using C under Microsoft Windows.\r
+\r
+Whilst we are committed to supporting Windows, unfortunately Windows \r
+support is not complete at this point. Whilst there is nothing in the \r
+code that is specifically incompatible with Windows, it is entirely \r
+untested, and there may be a number of tweaks that Windows users will \r
+have to make in order to compete.\r
+\r
+ = Options for Windows Users =\r
+\r
+ - Install a *nix compatibility layer, such as Cygwin or MinGW, which \r
+will allow you to develop as if on Linux. This is *by* *far* the \r
+simplest route: everything should, in theory, just work. However, it's \r
+untested.\r
+\r
+ - Attempt to use native Windows tools. If you choose to go down this \r
+path, note the following:\r
+    - agents are compiled by linking c_link together with the agent \r
+source.\r
+    - c_agents would need to be modified to use windows style paths \r
+instead of POSIX paths.\r
+    - The externAgent wrapper may need to be tweaked.\r
+\r
+Either way, be aware that the supervisor will spawn a *lot* of processes \r
+- up to 255 child processes. How Windows will cope with that, is, as \r
+mentioned before, totally untested.\r
+\r
+ = Alternatives =\r
+\r
+There are some alternatives to development in Windows that may be open \r
+to you:\r
+ - If you are a CS or Engineering student at UWA, use Mac or Linux \r
+machines in the CS labs.\r
+ - If you are a UCC member, use either our Mac or one of the Linux \r
+machines.\r
+\r
+These environments, if available to you, are preferable to development \r
+on Windows.\r
index aabdc23..ed461b5 100644 (file)
@@ -1,5 +1,5 @@
 # add your agents to this file by copying the definition and adjusting
-# you then need to modify simulate.py
+# you then need to make sure there's an arena that imports your agent
 
 from link.cAgent import cAgent
 

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