diff options
| -rw-r--r-- | CMakeLists.txt | 18 | ||||
| -rw-r--r-- | benchmark.py | 18 | ||||
| -rw-r--r-- | src/main/game/game_state.cpp | 4 | ||||
| -rw-r--r-- | src/main/game/global_cache.cpp | 4 |
4 files changed, 34 insertions, 10 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 4ab8e4a..ba6b41a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -132,10 +132,20 @@ endif() add_executable(solvitaire ${main} ${sources}) target_link_libraries(solvitaire LINK_PUBLIC ${Boost_LIBRARIES} -lprofiler) -# add a separete executable for the 'simple hash' version of the solver -add_executable(solvitaire-simple-hash ${main} ${sources}) -target_link_libraries(solvitaire-simple-hash LINK_PUBLIC ${Boost_LIBRARIES} -lprofiler) -set_target_properties(solvitaire-simple-hash PROPERTIES COMPILE_FLAGS -DSIMPLE_HASH) +# add a separete executable for the 'no card symmetry' version of the solver +add_executable(solvitaire-no-card-symmetry ${main} ${sources}) +target_link_libraries(solvitaire-no-card-symmetry LINK_PUBLIC ${Boost_LIBRARIES} -lprofiler) +set_target_properties(solvitaire-no-card-symmetry PROPERTIES COMPILE_FLAGS -DNO_CARD_SYMMETRY) + +# add a separete executable for the 'no pile symmetry' version of the solver +add_executable(solvitaire-no-pile-symmetry ${main} ${sources}) +target_link_libraries(solvitaire-no-pile-symmetry LINK_PUBLIC ${Boost_LIBRARIES} -lprofiler) +set_target_properties(solvitaire-no-pile-symmetry PROPERTIES COMPILE_FLAGS -DNO_PILE_SYMMETRY) + +# add a separete executable for the 'no symmetry' version of the solver +add_executable(solvitaire-no-symmetry ${main} ${sources}) +target_link_libraries(solvitaire-no-symmetry LINK_PUBLIC ${Boost_LIBRARIES} -lprofiler) +set_target_properties(solvitaire-no-symmetry PROPERTIES COMPILE_FLAGS "-DNO_CARD_SYMMETRY -DNO_PILE_SYMMETRY") # add a separete executable for the 'no reduced state' version of the solver add_executable(solvitaire-no-reduced-state ${main} ${sources}) diff --git a/benchmark.py b/benchmark.py index 943d3e7..10f45dd 100644 --- a/benchmark.py +++ b/benchmark.py @@ -19,12 +19,22 @@ if (len(sys.argv) >= 2 flag = "" if (len(sys.argv) >= 2 - and (sys.argv[1] == "--simple-hash" or sys.argv[1] == "-sh")): - flag = "-simple-hash" - print("Running in simple-hash mode...") + and (sys.argv[1] == "--no-card-symmetry" or sys.argv[1] == "-cs")): + flag = "-no-card-symmetry" + print("Running in no-card-symmetry mode...") if (len(sys.argv) >= 2 - and (sys.argv[1] == "--no-reduced-state" or sys.argv[1] == "-nrc")): + and (sys.argv[1] == "--no-pile-symmetry" or sys.argv[1] == "-ps")): + flag = "-no-pile-symmetry" + print("Running in no-pile-symmetry mode...") + +if (len(sys.argv) >= 2 + and (sys.argv[1] == "--no-symmetry" or sys.argv[1] == "-ps")): + flag = "-no-symmetry" + print("Running in no-symmetry mode...") + +if (len(sys.argv) >= 2 + and (sys.argv[1] == "--no-reduced-state" or sys.argv[1] == "-rc")): flag = "-no-reduced-state" print("Running in no-reduced-state mode...") diff --git a/src/main/game/game_state.cpp b/src/main/game/game_state.cpp index 097c744..a6186ff 100644 --- a/src/main/game/game_state.cpp +++ b/src/main/game/game_state.cpp @@ -277,13 +277,17 @@ void game_state::undo_move(const move m) { // reorders the pile refs so that the largest pile is first void game_state::place_card(pile_ref pr, card c) { piles[pr].place(c); +#ifndef NO_PILE_SYMMETRY eval_pile_order(pr, true); +#endif } // Same as above but for taking cards card game_state::take_card(pile_ref pr) { card c = piles[pr].take(); +#ifndef NO_PILE_SYMMETRY eval_pile_order(pr, false); +#endif return c; } diff --git a/src/main/game/global_cache.cpp b/src/main/game/global_cache.cpp index 37738f2..5d2fd79 100644 --- a/src/main/game/global_cache.cpp +++ b/src/main/game/global_cache.cpp @@ -84,7 +84,7 @@ void cached_game_state::add_card(card c, const game_state& gs) { #endif switch (gs.rules.build_pol) { -#ifdef SIMPLE_HASH +#ifdef NO_CARD_SYMMETRY default: target.emplace_back(c); break; @@ -152,7 +152,7 @@ std::size_t hasher::combine(std::size_t& seed, std::size_t value) const { size_t hasher::hash_value(card const& c) const { boost::hash<uint8_t> boost_hasher; -#ifdef SIMPLE_HASH +#ifdef NO_CARD_SYMMETRY uint8_t suit_val = c.get_suit(); #else uint8_t suit_val; |
