August 2018
Beginner
334 pages
10h 19m
English
We will add a new function to the BoardAI class as follows:
public static float Negamax(
Board board,
int maxDepth,
int currentDepth,
ref Move bestMove)
{
// next steps here
}
if (board.IsGameOver() || currentDepth == maxDepth)
return board.Evaluate();
bestMove = null; float bestScore = Mathf.NegativeInfinity;
foreach (Move m in board.GetMoves())
{
// next steps here
}
return bestScore;
Board b = board.MakeMove(m); float recursedScore; Move currentMove = null;
recursedScore = Negamax(b, maxDepth, currentDepth ...
Read now
Unlock full access