Add card pulling functionality for Player 2 and update hand display
This commit is contained in:
parent
c2d5d799fc
commit
4fb57a3ff5
21
poker.py
21
poker.py
@ -65,9 +65,26 @@ def main():
|
||||
player1.remove((rank, suit))
|
||||
print("Player 1 pulled", rank, "of", suit, "from his hand.")
|
||||
else:
|
||||
print("Card not found in Player 1's hand.")
|
||||
print("Card not found in Player 1's hand.")
|
||||
|
||||
pull_card_player2 = input("Player 2, enter a card to pull from your hand (e.g., 'A of Spades', or 'none'): ")
|
||||
if 'none' not in pull_card_player2.lower():
|
||||
rank, suit = pull_card_player2.split(' of ')
|
||||
if remove_card_from_hand(player2, (rank, suit)):
|
||||
player2.remove((rank, suit))
|
||||
print("Player 2 pulled", rank, "of", suit, "from his hand.")
|
||||
else:
|
||||
print("Card not found in Player 2's hand.")
|
||||
|
||||
print("\nAfter pulling cards:")
|
||||
print("Player 1's hand:\n", show_hand(player1))
|
||||
print()
|
||||
print("Player 2's hand:\n", show_hand(player2))
|
||||
print()
|
||||
|
||||
# Evaluate hands and determine winner
|
||||
|
||||
rank1 = hand_rank(player1)
|
||||
rank1 = hand_rank(player1)
|
||||
rank2 = hand_rank(player2)
|
||||
if rank1 > rank2:
|
||||
print("Player 1 wins! with rank:", rank1)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user