Skip to content

Commit

Permalink
Ensure that HashfullPermillApprox doesn't fail when tt length < 1k …
Browse files Browse the repository at this point in the history
…items
  • Loading branch information
eduherminio committed Jan 18, 2025
1 parent 4b4cfaa commit 652c4c7
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/Lynx/Model/TranspositionTable.cs
Original file line number Diff line number Diff line change
Expand Up @@ -126,11 +126,15 @@ public int HashfullPermill() => _tt.Length > 0
public readonly int HashfullPermillApprox()
{
int items = 0;
for (int i = 0; i < 1000; ++i)

if (_tt.Length >= 1_000)
{
if (_tt[i].Key != default)
for (int i = 0; i < 1_000; ++i)
{
++items;
if (_tt[i].Key != default)
{
++items;
}
}
}

Expand Down

0 comments on commit 652c4c7

Please sign in to comment.