protected virtual List<Region> GetAndPrintStartingRegions(IGameplayEngine forPlayer, List<Region> startingRegions, int _timeout) { var regions = forPlayer.GetPreferredStartingRegions(startingRegions, _timeout); if (regions == null || !regions.Any()) { ConsoleExtensions.WriteColoredLine(ConsoleColor.Red, "Player `{0}` didn't pick any starting regions!", forPlayer.Name); } else { string selected = string.Join(" ", regions.Select(r => r.ID.ToString()).ToArray()); ConsoleExtensions.WriteColoredLine(ConsoleColor.Green, "Player `{0}` picked starting regions: {1}", forPlayer.Name, selected); } return regions; }
/// <summary> /// Parses the "pick_starting_regions" line parts and issues the GetPreferredStartingRegions() method on the bot. /// </summary> /// <param name="bot"></param> /// <param name="parts"></param> /// <returns></returns> private static string PickStartingRegions(IGameplayEngine bot, string[] parts) { var pickable = GetPickableStartingRegions(bot.State.FullMap, parts); int timeout = int.Parse(parts[1]); var preferredStartingRegions = bot.GetPreferredStartingRegions(pickable, timeout); return string.Join(" ", preferredStartingRegions.Select(r => r.ID.ToString()).ToArray()); }