Exemple #1
0
        public int ControlPointEvalFunction(Coord location, Coord[] controlPoints)
        {
            int lowest = int.MaxValue;
            int value;

            foreach (Coord cp in controlPoints)
            {
                value = Coord.ManhattanDistance(cp, location);
                if (value < lowest)
                {
                    lowest = value;
                }
            }
            return(lowest);
        }
Exemple #2
0
        int DistToControlPoint(Coord playerLocation, Coord[] controlPoints)
        {
            int lowest = int.MaxValue;
            int value;

            foreach (Coord cp in controlPoints)
            {
                value = Coord.ManhattanDistance(cp, playerLocation);
                if (value < lowest)
                {
                    lowest = value;
                }
            }
            if (lowest == 0)
            {
                return((int)Math.Round(1.5 * (float)(Globals.width + Globals.height)));
            }
            return((Globals.width + Globals.height) - lowest);
        }