Named board positions commonly used as game starting points.
gamepos contains compact predefined position data for normal chess and Chess960 starts. Callers use these helpers when they need a known initial board state without parsing a FEN string.
template<typename TCont >
| void scid::core::gamepos::collectPositions |
( |
const scid::core::Game & |
game, |
|
|
TCont & |
dest |
|
) |
| |
|
inline |
Append all position snapshots of a game to a caller-supplied container.
The traversal follows PGN RAV semantics: a variation starts from the position before the move immediately preceding the RAV, and nested RAVs are emitted recursively. The resulting stream is intended for clients that need a flat representation of a game tree while still being able to reconstruct variation boundaries.
To follow one variation from a given snapshot, keep reading while the next snapshots have a greater GamePos::RAVdepth. The variation ends at the first snapshot with a lower depth, an equal depth with a different GamePos::RAVnum, or the end of dest.
for (const auto& pos : positions) {
if (pos.RAVdepth == 0) {
showMainlinePosition(pos.FEN, pos.lastMoveSAN);
}
}
void collectPositions(const scid::core::Game &game, TCont &dest)
Append all position snapshots of a game to a caller-supplied container.
Definition game_positions.h:88
- Template Parameters
-
| TCont | Container type supporting emplace_back() and back(). |
- Parameters
-
| game | Game whose main line and variations are traversed. |
| dest | Container to which snapshots are appended. Existing contents are preserved. |