diff --git a/cpp/src/model/ais/v1_simple.cpp b/cpp/src/model/ais/v1_simple.cpp index 99d1cb4..c61e0ef 100644 --- a/cpp/src/model/ais/v1_simple.cpp +++ b/cpp/src/model/ais/v1_simple.cpp @@ -2,29 +2,20 @@ #include "../utils/threadpool.hpp" #include "ai.hpp" -#include -#include - static int INFINITY = std::numeric_limits::max(); Move ai::v1_simple::_search(const Board& b) { ThreadPool pool(std::thread::hardware_concurrency()); - std::vector moves = b.all_legal_moves(); - std::map> futures; - for (int depth = 1; !stop_computation; depth++) { - for (const Move& move : moves) { - Board tmp_board = b.make_move(move); - futures.insert({move, pool.enqueue([&]() { - return _search(tmp_board, depth - 1); - })}); - } - } - Move best_move; int best_eval = -INFINITY; - for (auto& [move, future] : futures) { - int eval = future.get(); + std::vector moves = b.all_legal_moves(); + + for (const Move& move : moves) { + Board tmp_board = b.make_move(move); + int eval = _search(tmp_board, 4); + if (!am_white) + eval *= -1; if (eval > best_eval) { best_eval = eval; best_move = move;