/// <summary> /// Makes the best move in the queue /// </summary> /// <param name="movesQueue">queue of moves</param> void Act(List <Move> movesQueue) { if (thinkingStage == ThinkingStage.Done) { if (movesQueue.Count > 0) { MakeMove(movesQueue[0]); } else { GameManager.Instance.AILose(); } thinkingStage = ThinkingStage.Not; movesQueue.Clear(); } }
/// <summary> /// Thinks about what moves to make /// </summary> void Think() { thinkingStage = ThinkingStage.Thinking; //AlphaBeta thinkStartTime = Time.realtimeSinceStartup; if (GameManager.Instance.limitThinkTime) { rootMoves = AlphaBetaPruneTimed(BoardManager.Instance.boardChars, maxThinkDepth, true, float.MinValue, float.MaxValue); DEBUG_OutputPaths("Timed Alpha-Beta", rootMoves, Time.realtimeSinceStartup - thinkStartTime, maxThinkDepth); } else { rootMoves = AlphaBetaPrune(BoardManager.Instance.boardChars, maxThinkDepth, true, float.MinValue, float.MaxValue); DEBUG_OutputPaths("Alpha-Beta", rootMoves, Time.realtimeSinceStartup - thinkStartTime, maxThinkDepth); } thinkingStage = ThinkingStage.Done; }