示例#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);
        }
示例#2
0
 public MoveNode(MoveNode parent, int direction)
 {
     this.parent    = parent;
     this.direction = direction;
 }
示例#3
0
 public void MarkFailure()
 {
     currentNode.MarkDead();
     currentNode  = null;
     currentDepth = 0;
 }