add comments

This commit is contained in:
Maximilian Keßler 2023-11-16 16:29:41 +01:00
parent 3eea38ae05
commit 8cc30eb270
Signed by: max
GPG key ID: BCC5A619923C0BA5
6 changed files with 26 additions and 3 deletions

View file

@ -13,6 +13,9 @@
namespace Hanabi namespace Hanabi
{ {
/**
* A card together with an associated multiplicity
*/
struct CardMultiplicity struct CardMultiplicity
{ {
Card card; Card card;
@ -32,7 +35,7 @@ namespace Hanabi
virtual void rotate_next_draw(const Card & card) = 0; 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; virtual void revert() = 0;

View file

@ -23,7 +23,7 @@ namespace Hanabi
/** /**
* Define macro * Define macro
* NUSE_RATIONAL_PROBABILITIES * 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 * instead of rational representations
*/ */

View file

@ -1,6 +1,15 @@
#ifndef DYNAMIC_PROGRAM_MYASSERT_H #ifndef DYNAMIC_PROGRAM_MYASSERT_H
#define 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 #ifdef NDEBUG
#define ASSERT(x) do { (void)sizeof(x);} while (0) #define ASSERT(x) do { (void)sizeof(x);} while (0)
#else #else

View file

@ -13,6 +13,9 @@ namespace NullBuffer
{ return c; } { return c; }
}; };
/**
* A Stream that does nothing on writing to it
*/
class NullStream final : public std::ostream class NullStream final : public std::ostream
{ {
public: public:

View file

@ -36,7 +36,7 @@ namespace Parsing
// Overload for parsing from json to HanabLiveAction // Overload for parsing from json to HanabLiveAction
HanabLiveAction tag_invoke(boost::json::value_to_tag<HanabLiveAction>, boost::json::value const & jv); HanabLiveAction tag_invoke(boost::json::value_to_tag<HanabLiveAction>, boost::json::value const & jv);
/* /**
* @brief Parse deck from hanab.live format * @brief Parse deck from hanab.live format
* @return List of cards (in order) and number of suits * @return List of cards (in order) and number of suits
*/ */
@ -48,6 +48,10 @@ namespace Parsing
*/ */
std::vector<HanabLiveAction> parse_actions(const boost::json::value & action_json); std::vector<HanabLiveAction> 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<Hanabi::Action> convert_actions( std::vector<Hanabi::Action> convert_actions(
std::vector<HanabLiveAction> const & hanab_live_actions, std::vector<Hanabi::Card> const & deck std::vector<HanabLiveAction> const & hanab_live_actions, std::vector<Hanabi::Card> const & deck
); );

View file

@ -6,6 +6,10 @@
namespace Hanabi 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); void cli(Game const & game);
} }