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

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