diff --git a/CMakeLists.txt b/CMakeLists.txt index 70bdf75..5c09332 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,5 @@ cmake_minimum_required(VERSION 3.25) -project(dynamic_program CXX) +project(endgame-analyzer CXX) set(CMAKE_CXX_STANDARD 20) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wpedantic -Werror") @@ -11,22 +11,32 @@ include_directories( ) find_package(cpr) -find_package(Boost 1.81 COMPONENTS program_options REQUIRED) +find_package(Boost 1.81 COMPONENTS program_options unit_test_framework REQUIRED) + +set(Boost_USE_STATIC_LIBS ON) include_directories(.) include_directories(${Boost_INCLUDE_DIR}) -add_executable(endgame-analyzer src/main.cpp src/state_explorer.cpp src/download.cpp - include/null_buffer.h - include/command_line_interface.h +add_executable(endgame-analyzer + src/main.cpp + src/state_explorer.cpp + src/download.cpp + src/command_line_interface.cpp + src/parse_game.cpp + src/hanabi_types.cpp + src/game_interface.cpp + src/make_state.cpp +) + +add_executable(unit-tests + test/unit_test.cpp + src/state_explorer.cpp + src/download.cpp src/command_line_interface.cpp - include/parse_game.h src/parse_game.cpp - include/hanabi_types.hpp - include/game_interface.h src/hanabi_types.cpp src/game_interface.cpp - include/make_state.h src/make_state.cpp ) @@ -34,6 +44,11 @@ target_link_libraries(endgame-analyzer cpr) target_link_libraries(endgame-analyzer Boost::program_options) target_link_libraries(endgame-analyzer readline) +target_link_libraries(unit-tests cpr) +target_link_libraries(unit-tests Boost::program_options) +target_link_libraries(unit-tests readline) +target_link_libraries(unit-tests ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY}) + #set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -D_GLIBCXX_DEBUG") # This enables assertions in the RelWithDebInfo build type (assuming gcc or clang) string(REPLACE "-DNDEBUG" "" CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO}") diff --git a/README.md b/README.md index a98b27a..61db6f9 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ This is a dynamic program written in C++ to solve Hanabi endgames. Some optimizations are performed, but it is not particularly well-written at the moment and could also use some code cleanup. -As of now, you can run the executable with an id from a hanab.live game and a turn number (shifted by 1, since we start counting at 0 and hanab.live at 1) and the winning +As of now, you can run the executable with an id from a hanab.live game and a turn number and the winning percentage for the corresponding game state with optimum play will be calculated. Here, optimum play refers to the assumption that everbody knows their cards, but not the draw pile.