mirror of
https://github.com/RGBCube/serenity
synced 2025-07-28 13:57:36 +00:00
Hearts: Add support for playing more than one hand
This changes the game so that more than one hand can be played. Once one player has 100 or more points the game ends. A score card is shown between each hand. Fixes #7374.
This commit is contained in:
parent
e636ed43eb
commit
87ace131bc
6 changed files with 226 additions and 33 deletions
|
@ -24,7 +24,7 @@ public:
|
|||
|
||||
virtual ~Game() override;
|
||||
|
||||
void setup(String player_name);
|
||||
void setup(String player_name, int hand_number = 0);
|
||||
|
||||
Function<void(String const&)> on_status_change;
|
||||
|
||||
|
@ -33,6 +33,8 @@ private:
|
|||
|
||||
void reset();
|
||||
|
||||
void show_score_card(bool game_over);
|
||||
|
||||
void dump_state() const;
|
||||
|
||||
void play_card(Player& player, size_t card_index);
|
||||
|
@ -45,7 +47,7 @@ private:
|
|||
size_t player_index(Player& player);
|
||||
Player& current_player();
|
||||
bool game_ended() const { return m_trick_number == 13; }
|
||||
bool is_winner(Player& player);
|
||||
int calculate_score(Player& player);
|
||||
bool other_player_has_lower_value_card(Player& player, Card& card);
|
||||
bool other_player_has_higher_value_card(Player& player, Card& card);
|
||||
|
||||
|
@ -77,7 +79,6 @@ private:
|
|||
PassingSelectConfirmed,
|
||||
PassingAccept,
|
||||
Play,
|
||||
GameEndedWaiting,
|
||||
GameEnded,
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue