-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
33 lines (24 loc) · 940 Bytes
/
main.py
File metadata and controls
33 lines (24 loc) · 940 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
from poker.card import Card
from poker.deck import Deck
from poker.game_round import GameRound
from poker.hand import Hand
from poker.player import Player
deck = Deck()
cards = Card.create_standard_52_cards()
deck.add_cards(cards)
hand1 = Hand()
hand2 = Hand()
player1 = Player(name = "Vijay",hand = hand1)
player2 = Player(name = "Subhanu",hand = hand2)
players = [player1, player2]
game_round = GameRound(deck = deck, players = players)
game_round.play()
for player in players:
print(f"{player.name} receives a {player.hand}.")
index, hand_name, hand_cards = player.best_hand()
hand_cards_strings = [str(card) for card in hand_cards]
hand_cards_string = " and ".join(hand_cards_strings)
print(f"{player.name} has a {hand_name} with a {hand_cards_string}.")
winning_player = max(players)
print(f"The winner is {winning_player.name}.")
# from main import deck, cards, game_round, hand1, hand2, player1, player2