Example #1
0
        public static bool IsSafeMove(Ship ship, Direction direction)
        {
            MapCell target = GameInfo.CellAt(ship, direction);

            if (Fleet.CollisionCells.Contains(target))
            {
                return(false);
            }

            // calculate recovery chance...
            double recoveryChance = 1.0;

            if (target.IsThreatened)
            {
                var lowestEnemy = GameInfo.LowestNeighboringOpponentShip(target);
                recoveryChance = new Zone(target.position, 5).CargoRecoveryLikelihood(ship, lowestEnemy);
            }

            return(recoveryChance > MyBot.HParams[Parameters.SAFETY_RATIO]);
        }