Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rotating symmetric patterns with increasing skipsize #574

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 31 additions & 19 deletions src/search.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,33 @@ void MainThread::search() {
std::cout << sync_endl;
}

const int halfDensityMap[][9] =
{
{2, 0, 1},
{2, 1, 0},

{4, 0, 0, 1, 1},
{4, 0, 1, 1, 0},
{4, 1, 1, 0, 0},
{4, 1, 0, 0, 1},

{6, 0, 0, 0, 1, 1, 1},
{6, 0, 0, 1, 1, 1, 0},
{6, 0, 1, 1, 1, 0, 0},
{6, 1, 1, 1, 0, 0, 0},
{6, 1, 1, 0, 0, 0, 1},
{6, 1, 0, 0, 0, 1, 1},

{8, 0, 0, 0, 0, 1, 1, 1, 1},
{8, 0, 0, 0, 1, 1, 1, 1, 0},
{8, 0, 0, 1, 1, 1, 1, 0 ,0},
{8, 0, 1, 1, 1, 1, 0, 0 ,0},
{8, 1, 1, 1, 1, 0, 0, 0 ,0},
{8, 1, 1, 1, 0, 0, 0, 0 ,1},
{8, 1, 1, 0, 0, 0, 0, 1 ,1},
{8, 1, 0, 0, 0, 0, 1, 1 ,1},
};


// Thread::search() is the main iterative deepening loop. It calls search()
// repeatedly with increasing depth until the allocated thinking time has been
Expand Down Expand Up @@ -393,27 +420,12 @@ void Thread::search() {
while (++rootDepth < DEPTH_MAX && !Signals.stop && (!Limits.depth || rootDepth <= Limits.depth))
{
// Set up the new depths for the helper threads skipping on average every
// 2nd ply (using a half-density map similar to a Hadamard matrix).
// 2nd ply (using a half-density matrix).
if (!mainThread)
{
int d = rootDepth + rootPos.game_ply();

if (idx <= 6 || idx > 24)
{
if (((d + idx) >> (msb(idx + 1) - 1)) % 2)
continue;
}
else
{
// Table of values of 6 bits with 3 of them set
static const int HalfDensityMap[] = {
0x07, 0x0b, 0x0d, 0x0e, 0x13, 0x16, 0x19, 0x1a, 0x1c,
0x23, 0x25, 0x26, 0x29, 0x2c, 0x31, 0x32, 0x34, 0x38
};

if ((HalfDensityMap[idx - 7] >> (d % 6)) & 1)
continue;
}
int row = (idx - 1) % 20;
if (halfDensityMap[row][(rootDepth + rootPos.game_ply()) % halfDensityMap[row][0] + 1])
continue;
}

// Age out PV variability metric
Expand Down