當前位置: 首頁>>代碼示例>>Python>>正文


Python GameController._check_for_game_over方法代碼示例

本文整理匯總了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)
開發者ID:drtyrsa,項目名稱:durak,代碼行數:14,代碼來源:tests.py

示例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)
開發者ID:drtyrsa,項目名稱:durak,代碼行數:15,代碼來源:tests.py

示例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)
開發者ID:drtyrsa,項目名稱:durak,代碼行數:15,代碼來源:tests.py

示例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)
開發者ID:drtyrsa,項目名稱:durak,代碼行數:25,代碼來源:tests.py

示例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)
開發者ID:drtyrsa,項目名稱:durak,代碼行數:8,代碼來源:tests.py


注:本文中的durak.controller.GameController._check_for_game_over方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。