From 0684148d54e8839ced859e63906449368188d46e Mon Sep 17 00:00:00 2001 From: Charlie Blake Date: Mon, 11 Jun 2018 17:23:05 +0100 Subject: Speedup build and add lru cache --- src/main/solver/solver.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/main/solver/solver.cpp') diff --git a/src/main/solver/solver.cpp b/src/main/solver/solver.cpp index 7d490be..b227598 100644 --- a/src/main/solver/solver.cpp +++ b/src/main/solver/solver.cpp @@ -18,7 +18,7 @@ using std::cout; using std::clog; solver::solver(const game_state& gs) - : cache(gs) + : cache(new unlimited_cache(gs)) , init_state(gs) , state(gs) , states_searched(1) @@ -67,7 +67,7 @@ solver::sol_state solver::run(boost::optional &> terminate_solver) add_child(*dominance_move); } else { // Caches the current state - bool is_new_state = cache.insert(state); + bool is_new_state = cache->insert(state); if (is_new_state) { // Gets the legal moves in the current state vector next_moves = get_next_moves(); @@ -138,7 +138,7 @@ bool solver::revert_to_last_node_with_children() { // (as long as the move wasn't a dominance move) if (current_node->mv.type != move::mtype::dominance) { - assert(cache.contains(state)); + assert(cache->contains(state)); LOG_DEBUG("(undo move)"); } else { LOG_DEBUG("(undo dominance move)"); -- cgit v1.2.1