Exemple #1
0
        public override List <Move> Play()
        {
            for (int i = 0; i < UndockedShips.Count; i++)
            {
                Ship ship = UndockedShips[i];

                if (UnownedPlanets.Any())
                {
                    MoveToClosestPlanetAndDock(MoveList, UnownedPlanets, ship);
                }
                else if (DockableOwnedPlanets.Any())
                {
                    MoveToClosestPlanetAndDock(MoveList, DockableOwnedPlanets, ship);
                }
                else if (EnemyPlanets.Any())
                {
                    AttackDockedShipsAtClosestEnemyPlanet(ship);
                }

                if (AreAboutToTimeOut(i))
                {
                    break;
                }
            }

            return(MoveList);
        }
Exemple #2
0
        public override List <Move> Play()
        {
            List <Ship> shipsWithoutCommands = UndockedShips.ToList();

            for (int i = 0; i < UndockedShips.Count; i++)
            {
                Ship   ship   = shipsWithoutCommands[0];
                Planet planet = Navigation.GetClosestPlanetToShip(ship, UnownedPlanets);

                ship = Navigation.GetClosestShipToPlanet(planet, shipsWithoutCommands);

                if (ship.CanDock(planet))
                {
                    MoveList.Add(new DockMove(ship, planet));
                }
                else
                {
                    ThrustMove newThrustMove = Navigation.NavigateShipToDock(GameMap, ship, planet, Constants.MAX_SPEED);
                    if (newThrustMove != null)
                    {
                        MoveList.Add(newThrustMove);
                    }
                }

                UnownedPlanets.Remove(planet);
                shipsWithoutCommands.Remove(ship);
            }

            return(MoveList);
        }