diff --git a/include/game_interface.h b/include/game_interface.h index 01f486e..3d37ba9 100644 --- a/include/game_interface.h +++ b/include/game_interface.h @@ -13,6 +13,9 @@ namespace Hanabi { + /** + * A card together with an associated multiplicity + */ struct CardMultiplicity { Card card; @@ -32,7 +35,7 @@ namespace Hanabi virtual void rotate_next_draw(const Card & card) = 0; - virtual ActionType last_action_type() const = 0; + [[nodiscard]] virtual ActionType last_action_type() const = 0; virtual void revert() = 0; diff --git a/include/hanabi_types.hpp b/include/hanabi_types.hpp index d48594e..8fa10d3 100644 --- a/include/hanabi_types.hpp +++ b/include/hanabi_types.hpp @@ -23,7 +23,7 @@ namespace Hanabi /** * Define macro * NUSE_RATIONAL_PROBABILITIES - * to use floating-point arithematic for the stored probabilities + * to use floating-point arithmetic for the stored probabilities * instead of rational representations */ diff --git a/include/myassert.h b/include/myassert.h index 5eecfb5..8f587d8 100644 --- a/include/myassert.h +++ b/include/myassert.h @@ -1,6 +1,15 @@ #ifndef DYNAMIC_PROGRAM_MYASSERT_H #define DYNAMIC_PROGRAM_MYASSERT_H +/** + * @file myassert.h + * This is essentially like the default assert header, but we additionally + * dummy-use the expression in case NDEBUG is defined. + * This ensures that we do not get compiler warnings for variables that are solely + * used in assertions. + * If there are such variables, they will be optimized out in opt-mode anyway. + */ + #ifdef NDEBUG #define ASSERT(x) do { (void)sizeof(x);} while (0) #else diff --git a/include/null_buffer.h b/include/null_buffer.h index f329cee..250ab19 100644 --- a/include/null_buffer.h +++ b/include/null_buffer.h @@ -13,6 +13,9 @@ namespace NullBuffer { return c; } }; + /** + * A Stream that does nothing on writing to it + */ class NullStream final : public std::ostream { public: diff --git a/include/parse_game.h b/include/parse_game.h index d1e4e34..b94c0fd 100644 --- a/include/parse_game.h +++ b/include/parse_game.h @@ -36,7 +36,7 @@ namespace Parsing // Overload for parsing from json to HanabLiveAction HanabLiveAction tag_invoke(boost::json::value_to_tag, boost::json::value const & jv); - /* + /** * @brief Parse deck from hanab.live format * @return List of cards (in order) and number of suits */ @@ -48,6 +48,10 @@ namespace Parsing */ std::vector parse_actions(const boost::json::value & action_json); + /** + * @brief Convert actions from hanab.live format. + * @return List of actions with concrete cards instead of their indices. + */ std::vector convert_actions( std::vector const & hanab_live_actions, std::vector const & deck ); diff --git a/include/state_explorer.h b/include/state_explorer.h index 7cd1858..d2a8732 100644 --- a/include/state_explorer.h +++ b/include/state_explorer.h @@ -6,6 +6,10 @@ namespace Hanabi { + /** + * Launches an interactive shell (on cout/cin) that allows to display, traverse and modify + * the given game state. + */ void cli(Game const & game); }