Quaternity
debug.cpp
Go to the documentation of this file.
1 
8 #include <iostream>
9 #include <vector>
10 
11 #include "debug.h"
12 #include "round.h"
13 #include "settings.h"
14 #include "state.h"
15 
19 std::ostream &operator<<(std::ostream &out, const Card &card)
20 {
21  out << card.players;
22  return out;
23 }
24 
28 std::ostream &operator<<(std::ostream &out, const Player &player)
29 {
30  out << "(" << player.num_cards << "," << player.sets << ")";
31  return out;
32 }
33 
37 std::ostream &operator<<(std::ostream &out, const Settings &settings)
38 {
39  out << "Settings: "
40  << "set size = " << settings.SET_SIZE << ", "
41  << "num sets = " << settings.NUM_SETS << ", "
42  << "num players = " << settings.NUM_PLAYERS << "." << std::endl;
43  return out;
44 }
45 
49 std::ostream &operator<<(std::ostream &out, const State &state)
50 {
51  out << "Onturn: " << state.onturn << std::endl
52  << "Cards: " << state.cards << std::endl
53  << "Players: " << state.players << std::endl
54  << "Quartets: " << state.quartets << std::endl;
55  return out;
56 }
57 
61 std::ostream &operator<<(std::ostream &out, const Question &question)
62 {
63  out << "Question: "
64  << "player = " << question.player << ", "
65  << "set = " << question.set << ", "
66  << "card = " << question.card << "." << std::endl;
67  return out;
68 }
std::ostream & operator<<(std::ostream &out, const Card &card)
Print the information of a card struct.
Definition: debug.cpp:19
This file defines print operator headers for custom structs and a template for printing a vector....
This file defines the structs for a question and typedef of an answer.
This file defines the settings struct.
This file defines the structs for a card, player and a game state, plus a state initialize and copy f...
The information connected to a card.
Definition: state.h:19
std::vector< bool > players
The players which could have this card.
Definition: state.h:28
The information connected to a player.
Definition: state.h:34
std::vector< int > sets
The number of cards the player at least has from a certain set.
Definition: state.h:48
int num_cards
The number of cards this player has.
Definition: state.h:39
A question asked by a player. The player asks another player for a specific card from a certain set.
Definition: round.h:17
int set
The set the card which is asked belongs to.
Definition: round.h:27
int player
The player the question is asked to.
Definition: round.h:22
int card
The card in the set which is asked for.
Definition: round.h:32
The settings which characterize a game.
Definition: settings.h:22
const int NUM_SETS
The number of sets.
Definition: settings.h:32
const int SET_SIZE
The size of one set, aka the number of cards in one set.
Definition: settings.h:27
const int NUM_PLAYERS
The number of players playing the game.
Definition: settings.h:37
The complete game state.
Definition: state.h:57
std::vector< Player > players
The information on all the players.
Definition: state.h:81
std::vector< Card > cards
The information on all the cards.
Definition: state.h:74
int onturn
The player who is on turn.
Definition: state.h:62
std::vector< int > quartets
The information of who has a certain quartet.
Definition: state.h:90