Ejemplo n.º 1
0
            ////////////////////////////////////////////////////////////////////////////////////////////////////
            /// <summary>	Returns our estimate of the distance to nearest target from start node. </summary>
            ///
            /// <remarks>
            /// This is the classic computation for "dist from start" + "est dist to target" and forms the
            /// heart of the A* algorithm.
            /// </remarks>
            ///
            /// <returns>	Distance estimate. </returns>
            ////////////////////////////////////////////////////////////////////////////////////////////////////

            private double DistToNearestTarget()
            {
                // This is the classic computation for <dist from start> + <est dist to target>
                // and forms the heart of the A* algorithm
                return(_distanceFromStart + _targets.Select(t => StateData.EstDistance(t)).Min());
            }