- while (std::accumulate(db.begin(), db.end(), false, [&](bool repeat, KPKPosition& pos)
- { return (pos == UNKNOWN && pos.classify(db) != UNKNOWN) || repeat; })){}
-
- // Map 32 results into one KPKBitbase[] entry
- for (auto& pos : db)
- if (pos == WIN)
- KPKBitbase[pos.id / 32] |= 1 << (pos.id & 0x1F);
+ while (repeat)
+ for (repeat = idx = 0; idx < MAX_INDEX; ++idx)
+ repeat |= (db[idx] == UNKNOWN && db[idx].classify(db) != UNKNOWN);
+
+ // Fill the bitbase with the decisive results
+ for (idx = 0; idx < MAX_INDEX; ++idx)
+ if (db[idx] == WIN)
+ KPKBitbase.set(idx);