For most roles, there are different positional computations, but all of these can be found in PositionComputations.cpp
All roles with multiple robots (defenders, attackers, wallers) are calculated at the same time, to make it flexible for the amount of robots assigned to that role.
Defenders are assigned to the attackers that are closest to our goal. They only switch when an attacker comes significantly closer than the previous attackers. Unassigned defenders will function as wallers.
Attackers are assigned to an area of the field and look for the best position (based on the profile) within this area. Based on the amount of attackers, the area's we assign change.
For wallers, a line is calculated on which the wall should be with the middle point of the wall at the middle point of the line. This line is perpendicular to the line between the ball and our goal. From that point, we assign robots to a location on the line to form a wall. We determine the amount of wallers (2-4) and the position of the wall based on the position of the ball. Wallers not in the wall will function as defenders.
For single roles (harasser, keeper, passer, receiver, etc.) only one position is computated.
Harasser is always in between the ball and the goal and try to get the ball if no other robot is close or their robot with the ball is facing our goal.
The keeper is always standing in between the ball and the middle of our goal and moves onto the trajectory of the ball if shot.
The passers location is the location of the robot with the ball.
The receiver location is one of the 81 points we project onto the field. For each point a score for the pass is calculated. The point with the highest score will be the receiver location.
Profile Different roles have different desires when being positioned.
An offender that is preparing to shoot at the goal needs to have visibility
of the enemy goal but the possibility of a successful pass also needs to
be taken into consideration. A profile includes four desires: openness of the robot, line of sight between ball and robot, the potential for the position as a position to shoot at goal from and a blocking score.
Saving information Within every tick the world state stays the same,
this means that all computations and evaluations are the same for that
tick. To reduce the number of computations, the computations made
are saved linked to a position in its raw form (score and not the score
multiplied by the weight). If the score of a position is demanded, the code
will check if the computations for the required factor was already made
this tick and takes that value, or if not, compute the score of the position
for that factor.