✅ Project appears to freeze at some arbitrary point.

Code: https://mystb.in/7e159e940113ea2b2c With the code I have now, I get this output in console:
...
On square: 60
On square: 61
On square: 62
On square: 63
Linear occupations: 4096
On linear occupation 0/4096
Finished with mapping linear occupancy to bitmask.
Successfully hashed the occupancy.
...
On square: 60
On square: 61
On square: 62
On square: 63
Linear occupations: 4096
On linear occupation 0/4096
Finished with mapping linear occupancy to bitmask.
Successfully hashed the occupancy.
It gets all the way to the end and then freezes for an indefinite amount of time. This is the section I'm concerned about. Full file is in the pastebin above.
for (uint linearOccupation = 0; linearOccupation < (1UL << squares.Count); linearOccupation++)
{
if (square == 63) Console.WriteLine($"On linear occupation {linearOccupation}/{1UL << squares.Count}");

ulong mappedOccupancy = (ulong)MapLinearOccToSquares(squares, linearOccupation);

if (square == 63) Console.WriteLine("Finished with mapping linear occupancy to bitmask.");

int hash = (int)((mappedOccupancy * entry.magic) >> entry.shift);

if (square == 63) Console.WriteLine("Successfully hashed the occupancy.");

SLIDING_PIECE_MOVE_TABLE[entry.offset + hash] = (ulong)TraceOutRookMoves((long)mappedOccupancy, square);

if (square == 63) Console.WriteLine("Successfully stored value in table at hash.");
}
for (uint linearOccupation = 0; linearOccupation < (1UL << squares.Count); linearOccupation++)
{
if (square == 63) Console.WriteLine($"On linear occupation {linearOccupation}/{1UL << squares.Count}");

ulong mappedOccupancy = (ulong)MapLinearOccToSquares(squares, linearOccupation);

if (square == 63) Console.WriteLine("Finished with mapping linear occupancy to bitmask.");

int hash = (int)((mappedOccupancy * entry.magic) >> entry.shift);

if (square == 63) Console.WriteLine("Successfully hashed the occupancy.");

SLIDING_PIECE_MOVE_TABLE[entry.offset + hash] = (ulong)TraceOutRookMoves((long)mappedOccupancy, square);

if (square == 63) Console.WriteLine("Successfully stored value in table at hash.");
}
5 Replies
ACiDCA7
ACiDCA74mo ago
use the profiler... a quick hack would be to pause the application while its hanging and look at the stacktrace to see whats it currently doing *during debugging
it’s raining outside
whats that also turns out i was using longs instead of ulongs
ACiDCA7
ACiDCA74mo ago
whats what?
Angius
Angius4mo ago
Use the debugger to see where exactly it gets stuck
it’s raining outside
oh wait i got it sorted profiler ?close there we go
Want results from more Discord servers?
Add your server