public List <DepthFirstSearchNode> GetUnivisitedAdjacentNodes(DepthFirstSearchNode parent)
        {
            var nodes = new List <DepthFirstSearchNode>();

            //above
            if (IsValidAdjacent(parent.X, parent.Y - 1))
            {
                var node = new DepthFirstSearchNode(parent.X, parent.Y - 1);
                node.Parent = parent;
                nodes.Add(node);
            }

            //below
            if (IsValidAdjacent(parent.X, parent.Y + 1))
            {
                var node = new DepthFirstSearchNode(parent.X, parent.Y + 1);
                node.Parent = parent;
                nodes.Add(node);
            }

            //left
            if (IsValidAdjacent(parent.X - 1, parent.Y))
            {
                var node = new DepthFirstSearchNode(parent.X - 1, parent.Y);
                node.Parent = parent;
                nodes.Add(node);
            }

            //right
            if (IsValidAdjacent(parent.X + 1, parent.Y))
            {
                var node = new DepthFirstSearchNode(parent.X + 1, parent.Y);
                node.Parent = parent;
                nodes.Add(node);
            }

            return(nodes);
        }
 public DepthFirstSearchAlgorithm(int startX, int startY, int goalX, int goalY, string rawData)
 {
     P   = new DepthFirstSearchNode(startX, startY);
     G   = new DepthFirstSearchNode(goalX, goalY);
     map = new Map(rawData);
 }
        public bool IsNodeUnivisited(DepthFirstSearchNode node)
        {
            var found = visited.FirstOrDefault(x => x.Equals(node));

            return(found == null);
        }