예제 #1
0
 def play_hand(self):
     while not self.hand_over:
         current_round = Round(players=self.remaining_players,
                               start_player_index=self.__get_round_starting_index())
         current_round.play_round()
         self.__remove_players_with_no_cards()
         self.rounds.append(current_round)
예제 #2
0
    def test_when_class_has_previous_turn_then_last_turn_is_the_previous_turn(
            self, mocked_turn):
        cards = [PresidentCard(HEARTS, '3')]
        mocked_turn.cards_played.return_value = cards
        players = [
            StandardPlayer('Player1'),
            StandardPlayer('Player2'),
        ]

        game_round = Round(players=players, start_player_index=0)
        game_round.turns = [mocked_turn]

        self.assertEqual(cards, game_round.last_played)
예제 #3
0
    def test_when_class_has_previous_turn_then_last_player_is_the_previous_turn_player(
            self, mocked_turn):
        player1 = StandardPlayer('Player1')
        mocked_turn.player.return_value = [player1]
        players = [
            player1,
            StandardPlayer('Player2'),
        ]

        game_round = Round(players=players, start_player_index=0)
        game_round.turns = [mocked_turn]

        self.assertEqual(player1.name, game_round.last_player.name)
예제 #4
0
    def test_when_class_has_no_previous_turn_then_last_played_is_None(self):
        players = [
            StandardPlayer('Player1'),
            StandardPlayer('Player2'),
        ]
        game_round = Round(players=players, start_player_index=0)

        self.assertEqual(None, game_round.last_played)
예제 #5
0
    def test_when_class_is_constructed_then_class_variables_are_instantiated(
            self):
        players = [
            StandardPlayer('Player1'),
            StandardPlayer('Player2'),
        ]
        game_round = Round(players=players, start_player_index=0)

        self.assertEqual(0, len(game_round.turns))
        self.assertNotEqual(None, game_round.player_cycle)