I find that my engine-to-be yields a perft 5 of 4,865,351 that should (appearantly) be 4,865,609.
So I am missing a worrysome 258 positions. Very open to suggestions
Or is it considered close enough? (cannot imagine that)
Moderator: Ras
Code: Select all
position startpos moves e2e4
go perft 5
Code: Select all
// perft() is our utility to verify move generation. All the leaf nodes up
// to the given depth are generated and counted, and the sum is returned.
template<bool Root>
uint64_t perft(Position& pos, Depth depth) {
StateInfo st;
ASSERT_ALIGNED(&st, Eval::NNUE::CacheLineSize);
uint64_t cnt, nodes = 0;
const bool leaf = (depth == 2);
uint64_t start;
std::vector<std::string> rootMoves;
if (Root) {
start = std::chrono::duration_cast<std::chrono::milliseconds>
(std::chrono::steady_clock::now().time_since_epoch()).count();
}
for (const auto& m : MoveList<LEGAL>(pos))
{
if (Root && depth <= 1)
cnt = 1, nodes++;
else
{
pos.do_move(m, st);
cnt = leaf ? MoveList<LEGAL>(pos).size() : perft<false>(pos, depth - 1);
nodes += cnt;
pos.undo_move(m);
}
if (Root) {
std::string str = UCI::move(m, pos.is_chess960()) + ": " + std::to_string(cnt);
rootMoves.push_back(str);
//sync_cout << str << sync_endl; // uncomment this line if you want to display results when running
}
}
if (Root) {
std::sort(rootMoves.begin(), rootMoves.end());
for(auto && s : rootMoves) {
sync_cout << s << sync_endl;
}
auto elapsed = std::chrono::duration_cast<std::chrono::milliseconds>
(std::chrono::steady_clock::now().time_since_epoch()).count() - start;
sync_cout << "\nElapsed: " << elapsed << " ms" << sync_endl;
}
return nodes;
}
Code: Select all
go perft 5
a2a3: 181046
a2a4: 217832
b1a3: 198572
b1c3: 234656
b2b3: 215255
b2b4: 216145
c2c3: 222861
c2c4: 240082
d2d3: 328511
d2d4: 361790
e2e3: 402988
e2e4: 405385
f2f3: 178889
f2f4: 198473
g1f3: 233491
g1h3: 198502
g2g3: 217210
g2g4: 214048
h2h3: 181044
h2h4: 218829
Elapsed: 20 ms
Nodes searched: 4865609