Britbot
static Dictionary<Pirate, Direction> Britbot.Commander.GetAllMoves ( CancellationToken  cancellationToken) [inline, static, private]

Gets all th moves for each pirate in each group.

Parameters:
cancellationToken
Returns:
A dictionary that gives each pirate a direction to move to in this turn

Definition at line 458 of file Commander.cs.

        {
            //Remove all empty groups
            Commander.Groups.RemoveAll(g => g.Pirates.Count == 0);

            //Update all groups
            Parallel.ForEach(Commander.Groups, g => g.Update());

            //A list with all the moves from all groups
            List<KeyValuePair<Pirate, Direction>> allMoves =
                new List<KeyValuePair<Pirate, Direction>>(Bot.Game.AllMyPirates().Count);

            //Get the moves from each group we have
            foreach (Group group in Commander.Groups)
                allMoves.AddRange(group.GetGroupMoves(cancellationToken).ToList());

            //Convert the moves list to dictionary
            return allMoves.ToDictionary(pair => pair.Key, pair => pair.Value);
        }