Cluedo Solver v1.0
Cluedo game solver making deductions.
Loading...
Searching...
No Matches
Cluedo::Player Class Reference

The player of a game. More...

#include <Player.hpp>

Public Member Functions

 Player (std::string const &name, std::size_t card_count)
 
std::string const & name () const
 
std::size_t card_count () const
 
std::optional< bool > has_card (Card card) const
 
void add_in_hand_card (Card card)
 
void add_not_in_hand_card (Card card)
 
void add_possible_cards (CardSet const &set)
 

Detailed Description

The player of a game.

This class stores the information on a player by using two sets:

  • the first one will store the cards that we know the player has;
  • the second one will store the cards that we know the player doesn't have; and a vector that contains possibilities, a possibility is a set of cards which tells us that the player must have one of the cards in the set.

When new information is added to a player then we will try to infer new information on his cards.

Constructor & Destructor Documentation

◆ Player()

Cluedo::Player::Player ( std::string const & name,
std::size_t card_count )
inlineexplicit

Constructs a player.

Parameters
nameThe name of the player.
card_countThe number of cards held by the player.

Member Function Documentation

◆ add_in_hand_card()

void Cluedo::Player::add_in_hand_card ( Card card)
inline

Learns that the player has a card.

Parameters
cardThe card which the player has.

◆ add_not_in_hand_card()

void Cluedo::Player::add_not_in_hand_card ( Card card)
inline

Learns that the player doesn't have a card.

Parameters
cardThe card which the player doesn't have.

◆ add_possible_cards()

void Cluedo::Player::add_possible_cards ( CardSet const & set)
inline

Learns that the player has one of the card specified in set.

Parameters
setThe set of cards of which the player will have one.

◆ card_count()

std::size_t Cluedo::Player::card_count ( ) const
inline

Returns the number of cards held by the player.

Returns
The number of cards held by the player.

◆ has_card()

std::optional< bool > Cluedo::Player::has_card ( Card card) const
inline

Checks if a player has a card.

Returns
An optional that contains true if the player has the card, false if he doesn't and nothing if we don't know.

◆ name()

std::string const & Cluedo::Player::name ( ) const
inline

Returns the name of the player.

Returns
The name of the player.

The documentation for this class was generated from the following files: