Exemple #1
0
        public bool PathExists(Point a, Point b)
        {
            Node startNode = new Node(a);
            Node endNode   = new Node(b);

            openList.Push(startNode);

            while (openList.NotEmpty())
            {
                Node currentNode = openList.Pop();

                if (currentNode.Equals(endNode))
                {
                    MakePath(currentNode);
                    return(true);
                }

                List <Point> neighboors = _map.GetNeighboors(currentNode.x, currentNode.y);
                processList(currentNode, neighboors);

                closedList.Push(currentNode);
            }

            return(false);
        }