# a program that uses Card and Deck
import playing_cards

# this will be a game of "high card" and we will 26 hands for 2 players
# Ace is considered higher than any other card except another Ace
# and since Ace is stored as rank 1, we need code to check for rank 1

thedeck = playing_cards.Deck()
thedeck.shuffle()

player1wins = 0
player2wins = 0
ties = 0

for _ in range(26):
    player1card = thedeck.deal()
    player2card = thedeck.deal()

    print(f'Player1: {str(player1card)}')
    print(f'Player2: {str(player2card)}')
    
    if player1card.rank == player2card.rank:
        ties += 1
        print('Tie')
    elif player1card.rank == 1:
        player1wins += 1
        print('Player 1 wins')
    elif player2card.rank == 1:
        player2wins += 1
        print('Player 2 wins')
    elif player1card.rank > player2card.rank:   # here neither player has an Ace
        player1wins += 1
        print('Player 1 wins')
    else:
        player2wins += 1
        print('Player 2 wins')

    print()
    
print(f'Player 1 won {player1wins} times.')
print(f'Player 2 won {player2wins} times.')
print(f'There were {ties} ties.')



      
