本文整理汇总了Python中durak.controller.GameController._check_for_game_over方法的典型用法代码示例。如果您正苦于以下问题:Python GameController._check_for_game_over方法的具体用法?Python GameController._check_for_game_over怎么用?Python GameController._check_for_game_over使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类durak.controller.GameController
的用法示例。
在下文中一共展示了GameController._check_for_game_over方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_check_for_game_over_is_draw_if_both_players_have_no_cards
# 需要导入模块: from durak.controller import GameController [as 别名]
# 或者: from durak.controller.GameController import _check_for_game_over [as 别名]
def test_check_for_game_over_is_draw_if_both_players_have_no_cards(self):
controller = GameController()
controller._trump = DurakCard('6H')
controller._deck = []
controller._player1.cards = CardSet(cards=(), trump=controller._trump)
controller._player2.cards = CardSet(cards=(), trump=controller._trump)
controller._state = controller.States.MOVING
controller._logger_enabled = False
controller._check_for_game_over()
self.assertTrue(controller._state is None)
self.assertTrue(controller._winner is None)
示例2: test_check_for_game_over_does_nothing_if_both_players_have_cards
# 需要导入模块: from durak.controller import GameController [as 别名]
# 或者: from durak.controller.GameController import _check_for_game_over [as 别名]
def test_check_for_game_over_does_nothing_if_both_players_have_cards(self):
controller = GameController()
controller._trump = DurakCard('6H')
controller._deck = []
controller._player1.cards = CardSet(
cards=(DurakCard('AC'), DurakCard('8S')), trump=controller._trump
)
controller._player2.cards = CardSet(
cards=(DurakCard('KD'), DurakCard('KS')), trump=controller._trump
)
controller._state = controller.States.MOVING
controller._check_for_game_over()
self.assertEqual(controller._state, controller.States.MOVING)
示例3: test_check_for_game_over_does_nothing_if_responder_can_beat_with_last_card
# 需要导入模块: from durak.controller import GameController [as 别名]
# 或者: from durak.controller.GameController import _check_for_game_over [as 别名]
def test_check_for_game_over_does_nothing_if_responder_can_beat_with_last_card(self):
controller = GameController()
controller._state = controller.States.RESPONDING
controller._deck = []
controller._trump = DurakCard('6H')
controller._player1.cards = CardSet(cards=(), trump=controller._trump)
controller._player2.cards = CardSet(
cards=(DurakCard('KD'),), trump=controller._trump
)
controller._to_move = controller._player1
controller._on_table = [DurakCard('QD')]
controller._check_for_game_over()
self.assertEqual(controller._state, controller.States.RESPONDING)
示例4: test_check_for_game_over_player_wins_if_has_no_cards
# 需要导入模块: from durak.controller import GameController [as 别名]
# 或者: from durak.controller.GameController import _check_for_game_over [as 别名]
def test_check_for_game_over_player_wins_if_has_no_cards(self):
controller = GameController()
controller._trump = DurakCard('6H')
controller._deck = []
controller._player1.cards = CardSet(cards=(), trump=controller._trump)
controller._player2.cards = CardSet(
cards=(DurakCard('KD'), DurakCard('KS')), trump=controller._trump
)
controller._state = controller.States.MOVING
controller._logger_enabled = False
controller._check_for_game_over()
self.assertTrue(controller._state is None)
self.assertEqual(controller._winner, controller._player1)
controller._player1.cards = CardSet(
cards=(DurakCard('AC'), DurakCard('8S')), trump=controller._trump
)
controller._player2.cards = CardSet(cards=(), trump=controller._trump)
controller._state = controller.States.MOVING
controller._check_for_game_over()
self.assertTrue(controller._state is None)
self.assertEqual(controller._winner, controller._player2)
示例5: test_check_for_game_over_does_nothing_if_deck_is_not_empty
# 需要导入模块: from durak.controller import GameController [as 别名]
# 或者: from durak.controller.GameController import _check_for_game_over [as 别名]
def test_check_for_game_over_does_nothing_if_deck_is_not_empty(self):
controller = GameController()
controller._state = controller.States.MOVING
controller._deck = [DurakCard('7S'), DurakCard('8D')]
controller._check_for_game_over()
self.assertEqual(controller._state, controller.States.MOVING)