Skip to content

Commit c80ea4c

Browse files
committed
removed logging of debug metrics, reintroduced try-catch
1 parent aa570b3 commit c80ea4c

File tree

2 files changed

+5
-17
lines changed

2 files changed

+5
-17
lines changed

MinimalChess/Transpositions.cs

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,6 @@ namespace MinimalChess
77
{
88
public static class Transpositions
99
{
10-
public static long HashOverwrites = 0;
11-
public static long HashWrites = 0;
12-
public static int Count => _table.Length;
13-
public static int Empty => _table.Count(entry => entry.Hash == default);
14-
1510
public enum ScoreType : byte
1611
{
1712
GreaterOrEqual,
@@ -108,10 +103,6 @@ public static void Store(ulong zobristHash, int depth, SearchWindow window, int
108103
int index = Index(zobristHash);
109104
ref HashEntry entry = ref _table[index];
110105

111-
HashWrites++;
112-
if (entry.Hash != default && entry.Hash != zobristHash)
113-
HashOverwrites++;
114-
115106
//don't overwrite a bestmove with 'default' unless it's a new position
116107
if (entry.Hash != zobristHash || bestMove != default)
117108
entry.BestMove = bestMove;

MinimalChessBoard/Program.cs

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ static void Main()
4141
string command = tokens[0];
4242

4343
long t0 = Stopwatch.GetTimestamp();
44-
//try
44+
try
4545
{
4646
if (command == "reset")
4747
{
@@ -102,10 +102,10 @@ static void Main()
102102
if (dt > 0.01)
103103
Console.WriteLine($" Operation took {dt:0.####}s");
104104
}
105-
//catch (Exception error)
106-
//{
107-
// Console.WriteLine("ERROR: " + error.Message);
108-
//}
105+
catch (Exception error)
106+
{
107+
Console.WriteLine("ERROR: " + error.Message);
108+
}
109109
}
110110
}
111111

@@ -315,9 +315,6 @@ private static void CompareBestMove(int depth, string filePath, int maxCount)
315315
if (foundBestMove)
316316
foundBest++;
317317
Console.WriteLine($"{count,4}. {(foundBestMove ? "[X]" : "[ ]")} {pvString} = {search.Score:+0.00;-0.00}, {search.NodesVisited / 1000}K nodes, { 1000 * dt / freq}ms");
318-
Console.WriteLine($" TT Density: {(100 * (Transpositions.Count - Transpositions.Empty)) / Transpositions.Count}% TT Overwrites: {(100 * Transpositions.HashOverwrites) / Transpositions.HashWrites}%");
319-
Transpositions.HashOverwrites = 0;
320-
Transpositions.HashWrites = 0;
321318
}
322319
Console.WriteLine();
323320
Console.WriteLine($"Searched {count} positions to depth {depth}. {totalNodes/1000}K nodes visited. Took {totalTime/freq:0.###} seconds!");

0 commit comments

Comments
 (0)