The Dealer

The Dealer is responsible for giving each robot the best possible role on the field. The system worked with a Hungarian algorithm that would use a score map for each robot (n) and role (m) resulting in a scoring matrix (m,n), where a lower score is better and the score is based on the distance and speed to the role-location and the given flags. The algorithm checks the optimal distribution based on minimizing the score of the entire team. In other words, it would minimize the total score of the current priority.

The functionality of the dealer is as followed: After a play is initialized, creating the roles and initializing the flag map, the dealer distribution function is called that outputs a map linking a role name to a robot view.

Algorithm 6: Dealer::distribute(Robots, Roles, Info)
forall forced ID’s do
→ Deal IDs to roles in Map;
→ Remove ID and Role from lists
Get Role X Robot score matrix for remaining elements;
foreach priority in order do
→ Get the scores associated with this priority;
→ Get best assignments with the Hungarian algorithm;
→ Deal ID’s to roles in Map;
→ Remove ID and Role from lists;
return Distribution Map;

The current flags include:

When a flag is set, and it returns 1, we simply add a high number to the score. This makes sure we only pick this robot if there is no other options.

The current forcedIds are

The current priority order is:

  1. Keeper (Highest),
  2. Required,
  3. High Priority,
  4. Medium Priority,
  5. Low Priority (Lowest)
  6. Card (Only applicably if we have a card and need to remove a robot from the field)

Flowchart of how the dealer::distribution() function works