Final documentation tweaks.
[progcomp10.git] / src / USINGPYTHON.txt
1 USINGPYTHON.txt: An 11 step guide to writing an agent in Python.
2
3 0. Watch the sample agents in action and flick through the documentation.
4
5 1. Pick a name for your agent. Make sure the name is a valid python 
6 identifier. Be original.
7
8 2. Open SampleAgents.py.  Pick a sample agent to copy-paste (so you 
9 don't have to type out the function definitions).
10
11 3. Copy the sample agent code into a new file in the "agents" directory. 
12 Make sure the file has the same name as the agent.
13
14 4. Add the following lines to the beginning of your file:
15
16 from uccProgComp import BaseAgent, LearningAgent, RandomAttack
17 from rpsconst import *
18
19 5. Create an arena in which your agent can battle:
20
21    5.1. open arenas/MyArena.py
22
23    5.2. add "from agents.<youragentname> import <youragentname>"
24
25    5.3. modify the "Agents =" line to include your agent, and take out 
26 any agents you don't want to battle.
27
28 6. Watch your agent in action: ./simulate -v -a MyArena
29
30 7. Oh no, my agent dies very quickly: what's going on?
31
32    7.1 insert print statements in your python module. (Hint: prefix them 
33 with self.id so you can identify different agents)
34
35    7.2 Run "./simulate -v -n 1 -a MyArena" to start with only 1 of each 
36 agent.
37
38    7.3 Change the agents against which you're battling in MyArena.py so 
39 that you have a predictable opponent.
40
41    7.1 Edit conf.py, and set DEBUG=True. Don't forget to reset it when 
42 you're done.
43
44 8. Once your agent works to your satisfaction, try it both on short and 
45 long durations (100 and 1000 rounds: see MAX_ITERATIONS in conf.py)
46
47 9. If the rolling scoreboard has been opened on progcomp.ucc.asn.au/, 
48 submit it there! Otherwise, sit tight.
49
50 10. Watch its progress on the scoreboard and adjust your strategy 
51 accordingly.

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