Chess-Challenge
Chess-Challenge copied to clipboard
It would be great to have a benchmarking mode.
It would be really helpful to have a mode where instead of our bot playing against another bot, it just gets fed a bunch of different board positions so that we can record things like how long it takes to evaluate each one. I tried my hand at setting it up myself, but I'm not good enough with c#.
Make it play against itself and make it so playing as black it returns a null move.
Here's what I do to get some basic info
// Declare an array of int, which will hold evaluations for root moves
int[] array_intEvaluations = new int[moves.Length];
// Save time at the start of the root loop
DateTime floatStartTime = System.DateTime.Now;
for (int i = 0; i < moves.Length; i++)
{
board.MakeMove(moves[i]);
array_intEvaluations[i] = -Search(1, -color, -99999999, 99999999);
board.UndoMove(moves[i]);
}
// Save time at the end of the root loop
DateTime floatFinishTime = System.DateTime.Now;
// Calculate time span between finish and start
TimeSpan timespanSpan = floatFinishTime - floatStartTime;
// Output final evaluations for root moves into console
for (int i = 0; i < array_intEvaluations.Length; i++)
{
Console.Write(array_intEvaluations[i].ToString() + " ");
}
// Output measurements, including time spent on evaluation, into console
Console.WriteLine
(
"\nTime taken: " + timespanSpan.TotalMilliseconds.ToString()
+ ", nodes visited: " + intNodesVisited.ToString()
+ ", kN/s: " + (intNodesVisited / timespanSpan.TotalMilliseconds).ToString()
+ ", Table hits: " + intTableHits.ToString() + ", out of: " +intTableSize.ToString()
+ " AB triggered: " + intABTriggers.ToString()
+ ", branches pruned: " + intBranchesPruned.ToString()
);