made lambda capture values by reference, not by
value
This commit is contained in:
parent
108c0c3b90
commit
6d8a3f7dc0
@ -16,11 +16,9 @@ std::string ai::v1_simple::search(std::string pos, int depth) {
|
|||||||
std::map<std::string, std::future<int>> futures;
|
std::map<std::string, std::future<int>> futures;
|
||||||
for (const Move& move : moves) {
|
for (const Move& move : moves) {
|
||||||
Board tmp_board = b.make_move(move);
|
Board tmp_board = b.make_move(move);
|
||||||
futures.insert(
|
futures.insert({move.to_string(), pool.enqueue([&]() {
|
||||||
{move.to_string(), pool.enqueue([this, tmp_board, depth]() {
|
return minimax(tmp_board, depth - 1);
|
||||||
return minimax(tmp_board, depth - 1);
|
})});
|
||||||
})}
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string best_move;
|
std::string best_move;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user