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

Function copyDatabasePathToRoot

Rapfi/database/dbutils.cpp:36–60  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

34using namespace Database;
35
36void copyDatabasePathToRoot(DBStorage &dbSrc, DBStorage &dbDst, Board &board, Rule rule)
37{
38 std::vector<Pos> path;
39 path.reserve(board.ply());
40
41 while (board.ply() > 0) {
42 Pos move = board.getLastMove();
43 path.push_back(move);
44 board.undo(rule);
45 }
46
47 DBRecord record, tempRecord;
48 DBKey key;
49 while (path.size()) {
50 Pos pos = path.back();
51 path.pop_back();
52
53 board.move(rule, pos);
54 key = constructDBKey(board, rule);
55
56 if (dbSrc.get(key, record, RECORD_MASK_ALL)
57 && !dbDst.get(key, tempRecord, RECORD_MASK_NONE))
58 dbDst.set(key, record, RECORD_MASK_ALL);
59 }
60}
61
62void copyDatabaseBranch(DBStorage &dbSrc,
63 DBStorage &dbDst,

Callers 1

splitDatabaseFunction · 0.85

Calls 10

constructDBKeyFunction · 0.85
plyMethod · 0.80
getLastMoveMethod · 0.80
setMethod · 0.80
reserveMethod · 0.45
push_backMethod · 0.45
undoMethod · 0.45
sizeMethod · 0.45
moveMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected