コード例 #1
0
ファイル: game_test.py プロジェクト: khodzha/pyfo
    def test_failing_defense_pushes_attack_cards_into_defender_hand(self):
        game = Game()
        game.turn = 'player'

        game.attack_cards = [Card(Suit.CLUBS, Rank.JACK)]
        game.defender.hand = []

        game.defend()
        assert game.defender.hand[0] == Card(Suit.CLUBS, Rank.JACK)
コード例 #2
0
ファイル: ai_player_test.py プロジェクト: khodzha/pyfo
    def test_defense_when_cant_beat_attack(self):
        hand = [
            Card(Suit.CLUBS, Rank.SEVEN),
            Card(Suit.HEARTS, Rank.SEVEN),
            Card(Suit.SPADES, Rank.SEVEN),
            Card(Suit.HEARTS, Rank.JACK),
            Card(Suit.CLUBS, Rank.JACK),
            Card(Suit.SPADES, Rank.JACK)
        ]
        game = Game()
        game.trump = Card(Suit.DIAMONDS, Rank.SIX)
        game.attack_cards = [Card(Suit.CLUBS, Rank.ACE)]
        p = AIPlayer(hand=hand, game=game)

        assert p.defend() == None
コード例 #3
0
ファイル: ai_player_test.py プロジェクト: khodzha/pyfo
    def test_successful_defense(self):
        hand = [
            Card(Suit.CLUBS, Rank.KING),
            Card(Suit.HEARTS, Rank.SIX),
            Card(Suit.SPADES, Rank.ACE),
            Card(Suit.CLUBS, Rank.ACE),
            Card(Suit.HEARTS, Rank.ACE),
            Card(Suit.SPADES, Rank.JACK)
        ]
        game = Game()
        game.trump = Card(Suit.DIAMONDS, Rank.SIX)
        game.attack_cards = [
            Card(Suit.CLUBS, Rank.QUEEN),
            Card(Suit.HEARTS, Rank.QUEEN)
        ]
        p = AIPlayer(hand=hand, game=game)

        assert p.defend() == [
            Card(Suit.CLUBS, Rank.KING),
            Card(Suit.HEARTS, Rank.ACE)
        ]