| 29 | }; |
| 30 | |
| 31 | class Chess : public Game |
| 32 | { |
| 33 | public: |
| 34 | explicit Chess() : Game{ 2 } {} |
| 35 | |
| 36 | protected: |
| 37 | void start() override |
| 38 | { |
| 39 | cout << "Starting a game of chess with " << number_of_players << " players\n"; |
| 40 | } |
| 41 | |
| 42 | bool have_winner() override |
| 43 | { |
| 44 | return turns == max_turns; |
| 45 | } |
| 46 | |
| 47 | void take_turn() override |
| 48 | { |
| 49 | cout << "Turn " << turns << " taken by player " << current_player << "\n"; |
| 50 | turns++; |
| 51 | current_player = (current_player + 1) % number_of_players; |
| 52 | } |
| 53 | |
| 54 | int get_winner() override |
| 55 | { |
| 56 | return current_player; |
| 57 | } |
| 58 | |
| 59 | private: |
| 60 | int turns{ 0 }, max_turns{ 10 }; |
| 61 | }; |
| 62 | |
| 63 | int main() |
| 64 | { |
nothing calls this directly
no outgoing calls
no test coverage detected