6#include "../../serialization/uuid_generator.h"
7#include "../../../../rapidjson/include/rapidjson/document.h"
8#include "../../serialization/unique_serializable.h"
9#include "../../serialization/serializable_value.h"
24 std::vector<serializable_value<int>*> _scores;
40 player(
const std::string&
id,
54 explicit player(
const std::string& name);
67 player(
const std::string&
id,
const std::string& name);
87 [[nodiscard]] std::vector<serializable_value<int>*>
get_scores()
const noexcept;
175 void write_into_json(rapidjson::Value& json, rapidjson::Document::AllocatorType& allocator)
const override;
Represents a card in the game.
Definition card.h:15
Represents a player's hand in the game.
Definition hand.h:15
Represents a player in the game.
Definition player.h:18
~player() override
Destructs a player object.
Definition player.cpp:29
void write_into_json(rapidjson::Value &json, rapidjson::Document::AllocatorType &allocator) const override
Serializes a player object into a json object.
Definition player.cpp:152
void wrap_up_round()
Calculates the new score of the player.
Definition player.cpp:132
void set_nof_predicted(int nof_predicted) const
Sets the player's number of predicted tricks to the given input.
Definition player.cpp:97
int get_nof_predicted() const noexcept
Gets the number of tricks predicted to be won by the player in the current round.
Definition player.cpp:92
std::string get_player_name() const noexcept
Gets the player's name.
Definition player.cpp:104
unsigned int get_nof_cards() const noexcept
Gets the number of cards in the player's hand.
Definition player.cpp:114
static player * from_json(const rapidjson::Value &json)
Deserializes a player object from a json object.
Definition player.cpp:177
int get_nof_tricks() const noexcept
Gets the number of tricks won by the player in the current round.
Definition player.cpp:80
void set_nof_tricks(int nof_tricks) const
Sets the player's number of won tricks to the given input.
Definition player.cpp:85
void setup_round() const
Sets up the player for the next round.
Definition player.cpp:126
void set_game_id(const std::string &game_id)
Sets the game id of the player.
Definition player.cpp:61
bool add_card(card *card, std::string &err) const
Adds a card to the player's hand.
Definition player.cpp:121
std::vector< serializable_value< int > * > get_scores() const noexcept
Gets the scores of the player.
Definition player.cpp:68
void set_scores(int score)
Sets the player's scores to the given scores.
Definition player.cpp:73
hand * get_hand() const noexcept
Gets the player's hand.
Definition player.cpp:109
std::string get_game_id()
Gets the game id of the game the player has joint.
Definition player.cpp:56
Definition serializable_value.h:27
Definition unique_serializable.h:12