public void StartTurn(string boardLayout) { TurnCount++; BotEnvironment.DumpLayout(boardLayout); ParseGameState(boardLayout); ChooseStrategy().DoTurn(this); }
// Constructs a PlanetWars object instance, given a string containing a // description of a game state. public Universe(botDebugBase debugger) { BotEnvironment.ClearTrace(); Universe.TurnCount = 0; Debugger = debugger; Planets = new Dictionary <int, Planet>(); }
//public class Item //{ // public PlanetTurn turn; // public Route route; //} //private void test() //{ // List<Item> totry = new List<Item>(); // foreach (Planet plan in Planets.Values) // { // PlanetTurn turn = plan.TurnPrediction[0]; // if (turn.Owner == 1) // { // foreach (Route route in plan.Routes) // { // if (route.DestinationStateOnArrival.NumShips < turn.NumShips && // route.DestinationStateOnArrival.Owner != 1) // { // Item item = new Item(); // item.turn = turn; // item.route = route; // totry.Add(item); // } // } // } // } //} // Sends an order to the game engine. An order is composed of a source // planet number, a destination planet number, and a number of ships. A // few things to keep in mind: // * you can issue many orders per turn if you like. // * the planets are numbered starting at zero, not one. // * you must own the source planet. If you break this rule, the game // engine kicks your bot out of the game instantly. // * you can't move more ships than are currently on the source planet. // * the ships will take a few turns to reach their destination. Travel // is not instant. See the Distance() function for more info. private void IssueOrder(Planet source, Planet dest, int numShips) { string message = String.Format("{0} {1} {2}", source.PlanetID, dest.PlanetID, numShips); source.IdleForThisNumberOfTurns = 0; Console.WriteLine(message); Console.Out.Flush(); BotEnvironment.DumpMove(message); if (Debugger != null) { Debugger.IssueOrder(message); } }