Ejemplo n.º 1
0
        public long NextMove()
        {
            if (currentNode == null)
            {
                foreach (MoveNode node in children)
                {
                    if (node.alive)
                    {
                        currentNode = node;
                        break;
                    }
                }
            }
            else
            {
                currentNode = currentNode.NextAvailableChild();
            }

            if (++currentDepth > recordDepth)
            {
                recordDepth = currentDepth;
                Console.WriteLine($"New Record Depth: {currentDepth}");
            }

            return(currentNode.direction);
        }
Ejemplo n.º 2
0
 public MoveNode(MoveNode parent, int direction)
 {
     this.parent    = parent;
     this.direction = direction;
 }
Ejemplo n.º 3
0
 public void MarkFailure()
 {
     currentNode.MarkDead();
     currentNode  = null;
     currentDepth = 0;
 }