= Behaviour Code Description =

== What this section is about ==
Im sure alot of us are at the moment intimidated by the large code base of the runswift code. 
I've tried going through parts of it and I got confused very quickly. Anyway, I decided to 
tackle the Python code first, since that seems to be the most relevant part of the code at 
the moment, and try figuring out the overall structure of that code. This section is kind of 
an intro to the Behaviour part of the code.

== Stuff ==

So, in the trunk/robot/PyCode it looks like there is a whole bunch of Python src files relating
to the high level behaviours of the dogs. This is the stuff which is going to be dealt with mostly 
in the 3431 assignments I assume. Below is a short description of what each file appears to do ("appears" 
because I am only going by what little documentation there is and my poor understanding of the code)

Action.py - This file contains functions which perform fairly low level actions such as opening the dogs 
mouth or walking in a certain direction with a certain speed, or turning the dogs head. 

Behaviou.py - This is the top level code for all behaviours, its the first python module to be called 
from the underlying code.

Constant.py - contains all the constants used by the Python code such as for example the dimensions of the field.

Global.py - contains the data passed to the python code from the underlying C++ code such as localisation data, 
vision data, stuff like that. Basically stuff the behaviours might want to know about the world which is calculated
by the lower level modules. 

Indicator.py - has function calles for using the LED indicators on the dogs, used for debugging I guess.

cName.py - (files which are of the form c*.py, eg: cPassing.py) these files contain code for controlling the 
dogs in the challenges, such as the SLAM challenge or the variable lighting challenge for example.

fName.py - this is code for assigning global formation to the dogs, high level strategy. So its basically 
code which assigns roles to the dogs based on the current high level strategy. (like, do we want 3 defenders, or
1 attacker and 2 defenders, etc).

pName.py - player behaviour. There are two main behaviours which are used during matches it seems, Goalie and Forward, 
the goalie is a fixed role, but the 3 forwards can each have separate roles (so one can be a defender even for example).
Obstacle it seems is just when you want a robot to stand still on the field and act as an obstacle. 

rName.py - these are the files for the role code, such a striker or winger roles. It seems like these are the files
which contain the meat of the behaviour code.

hName.py - helper functions and stuff? Not really sure about these.

sName.py - the code for the different skills are in these files. Skills seem to be some common routines which are 
used in many different roles. So find ball for example is a skill, so is dribble say. 

tName.py - testing stuff Im guessing.


== Basic Flow of Control ==
I tried tracing through the very top level kind of flow through the behaviour code and this is what I understood it 
to be:
We start off in Behaviou.py in processFrame which figures out what game state we are currently in, and then calls 
the DecideNextAction for the current player type of the robot. This happens if we are in game, otherwise it will do 
stuff like try to get into ready position, but anyway...
Assuming our robot is a Forward player, we end up in the Forward.py in playGameMode. In this function we call the 
current formation and ask it to assign a role to the robot. Once the robot has a role assigned to it, it is performed. 
So assuming the robot is an Attacker, we now end up in rAttacker.py in perform, where we do all the stuff to make 
the robot attack :-)


Anyway, this is just some random stuff that I thought might be useful for someone looking at the code for the very 
first time and being very very confused.