Beispiel #1
0
        public int[] makeNextMove(Grid board)
        {
            PriorityQueue<MoveNode> q = new PriorityQueue<MoveNode>();
              	q.initialize(expandNodes(board, null, 1));
               	MoveNode current = q.Dequeue();

              	while ((current.Ply < depth) && !(q.isEmpty))
              	{
               		MoveNode next = q.Dequeue();
               	if(next.Rank> current.Rank)
               	{
                    current = next;
                    MoveNode[] expnd = expandNodes(current.Board, current, (current.Ply + 1));
                    if(expnd.Length > 0)
                        q.EnqueueArray(expnd);
                }
             	}

              	while(current.Ply > 1)
              	{
               		current = current.PreviousMove;
              	}
             	//this will be the best move to make after expanding down to depth plys.
              	int[] result = { current.Group.X, current.Group.Y };
              	Console.WriteLine("rank: " + current.Rank);

               	return result;
        }