MCPcopy Create free account
hub / github.com/dhbloo/rapfi / StackArray

Method StackArray

Rapfi/search/ab/searchstack.h:82–104  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

80 static constexpr int plyAfterMax = 2;
81
82 StackArray(int maxPly, Value initStaticEval) : triPvTable((maxPly + 1) * (maxPly + 2) / 2)
83 {
84 auto nextTriPvIndex = [&, idx = 0](int ply) mutable -> Pos * {
85 Pos *curPv = nullptr;
86 if (ply >= 0 && ply <= maxPly) {
87 assert(0 <= idx && idx < triPvTable.size());
88 curPv = &triPvTable[idx];
89 idx += maxPly + 1 - ply;
90 }
91 return curPv;
92 };
93
94 reserve(maxPly + plyBeforeRoot + plyAfterMax);
95 for (int i = -plyBeforeRoot; i < maxPly + plyAfterMax; i++)
96 push_back(SearchStack {nextTriPvIndex(i), i});
97
98 // Initialize static evaluation for plies before root
99 Value staticEval = initStaticEval;
100 for (int i = plyBeforeRoot; i >= 0; i--) {
101 (*this)[i].staticEval = staticEval;
102 staticEval = -staticEval;
103 }
104 }
105 SearchStack *rootStack() { return &(*this)[plyBeforeRoot]; }
106
107private:

Callers

nothing calls this directly

Calls 1

sizeMethod · 0.45

Tested by

no test coverage detected