#include #include #include enum Suit {NOSUIT = 0, CLUBS, SPADES, HEARTS, DIAMONDS}; enum Rank {NORANK = 0, ACE = 1, R2 = 2, R3 = 3, R4 = 4, R5 = 5, R6 = 6, \ R7 = 7, R8 = 8, R9 = 9, R10 = 10, JACK = 11, QUEEN = 12, KING = 13}; class Card { public: Suit suit; Rank rank; bool operator==(const Card &other) const; }; enum MoveType {PICKUP, HIT, BEAT, MOVE}; struct Move { int player; MoveType movetype; Card owncard; Card othercard; // Only with movetype == BEAT }; struct Player { int id; std::string name; std::vector hand; bool active; ClientSocket *socket; }; struct TableCard { Card tobeat; Card beater; }; struct GameState { std::vector players; std::vector table; int turn; int cards_in_hand; std::vector deck; std::vector winners; Suit trump; }; bool rank_higher(Rank a, Rank b); bool can_beat(const Card &, const Card &, Suit); bool is_card(const Card &); void remove_card(std::vector &cards, Card card); bool all_beaten(const std::vector &); void fill_hands(GameState &); bool game_ended(const GameState &); int next_turn(const GameState &); bool legal_move(const GameState &, const Move &); void apply_move(GameState &, const Move &);