Esempio n. 1
0
        private static SmartMove GetBestMoveToClaimedPlanet(GameMaster gameMaster, Ship ship, int curCount)
        {
            SmartMove bestMove = null;

            foreach (Planet planet in gameMaster.ClaimedPlanets)
            {
                //Do nothing to my planet
                if (planet.GetOwner() == gameMaster.MyPlayerId)
                {
                    continue;
                }

                foreach (var shipId in planet.GetDockedShips())
                {
                    //TODO: Verify this works
                    var enemyShip = gameMaster.GameMap.GetShip(planet.GetOwner(), shipId);
                    var move      = NavigateToTarget(ship, gameMaster.GameMap, ship.GetClosestPoint(enemyShip));

                    if (move == null)
                    {
                        continue;
                    }

                    move.Value = ClaimedPlanetMultiplier(move.Value, curCount);
                    if (move.CompareTo(bestMove) > 0)
                    {
                        bestMove = move;
                    }
                }
            }
            return(bestMove);
        }
Esempio n. 2
0
        private static SmartMove GetBestMoveToUnclaimedPlanet(GameMaster gameMaster, Ship ship)
        {
            SmartMove bestMove = null;

            foreach (Planet planet in gameMaster.UnClaimedPlanets)
            {
                if (ship.CanDock(planet))
                {
                    bestMove = new SmartMove(double.MaxValue, new DockMove(ship, planet));
                    break;
                }

                var move = NavigateToTarget(ship, gameMaster.GameMap, ship.GetClosestPoint(planet));
                if (move == null)
                {
                    continue;
                }

                move.Value = UnclaimedPlanetMultiplier(move.Value);
                if (move.CompareTo(bestMove) > 0)
                {
                    bestMove = move;
                }
            }
            return(bestMove);
        }
Esempio n. 3
0
        private SmartMove BestMoveToClaimedPlanet(GameMaster gm)
        {
            SmartMove bestMove = null;

            foreach (var claimedPlanet in gm.ClaimedPlanets)
            {
                //Do nothing to my planet
                if (claimedPlanet.GetOwner() == gm.MyPlayerId)
                {
                    continue;
                }

                foreach (var shipId in claimedPlanet.GetDockedShips())
                {
                    //TODO: Verify this works
                    var enemyShip = gm.GameMap.GetShip(claimedPlanet.GetOwner(), shipId);
                    var move      = NavigateToTarget(gm.GameMap, Me.GetClosestPoint(enemyShip));

                    if (move == null)
                    {
                        continue;
                    }

                    move.Value = ClaimedPlanetMultiplier(move.Value);

                    if (move.CompareTo(bestMove) > 0)
                    {
                        bestMove = move;
                    }
                }
            }
            return(bestMove);
        }
Esempio n. 4
0
        private SmartMove BestMoveToUnclaimedPlanet(GameMaster gm)
        {
            SmartMove bestMove = null;

            foreach (var unClaimedPlanet in gm.UnClaimedPlanets)
            {
//                if (!unClaimedPlanet.IsFull() && Me.CanDock(unClaimedPlanet))
                if (Me.CanDock(unClaimedPlanet))
                {
                    return(new SmartMove(int.MaxValue, new DockMove(Me, unClaimedPlanet)));
                }

                //                var move = NavigateToTarget(gm.GameMap, Me.GetClosestPoint(unClaimedPlanet));
                var       newThrustMove = Navigation.NavigateShipToDock(gm.GameMap, Me, unClaimedPlanet, _thrust);
                SmartMove move          = null;
                if (newThrustMove != null)
                {
                    double val = _distanceNumerator / Me.GetDistanceTo(Me.GetClosestPoint(unClaimedPlanet));
                    move = new SmartMove(UnclaimedPlanetMultiplier(val), newThrustMove);
                }

                if (move != null && move.CompareTo(bestMove) > 0)
                {
                    bestMove = move;
                }
            }

            return(bestMove);
        }
Esempio n. 5
0
        private SmartMove BestGameMove(GameMaster gm)
        {
            //TODO: GameStates aren't set, and unsure of how to combine this with other 2 moves
            SmartMove move = new SmartMove(double.MinValue, null);

            if (gm.GameState == GameState.Winning)
            {
            }
            else if (gm.GameState == GameState.Balanced)
            {
            }

            return(move);
        }