-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlab.py
34 lines (23 loc) · 789 Bytes
/
lab.py
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
33
34
import poker
def main():
deck = poker.get_deck()
computer_hand = poker.get_cards(5, deck)
user_hand = poker.get_cards(5, deck)
poker.print_hand(user_hand, 'User hand: ')
for card in poker.sort_cards(user_hand):
ans = ''
while ans not in ['y', 'n']:
ans = input(f'Replace {card}? [y / n] ')
if ans == 'y':
poker.replace_card(user_hand, card, *poker.get_cards(1, deck))
poker.print_hand(computer_hand, '\nComputer hand: ')
poker.print_hand(user_hand, 'User hand: ')
match poker.compare_hands(user_hand, computer_hand):
case 0:
print('User wins!')
case 1:
print('Computer wins!')
case 2:
print('Draw!')
if __name__ == '__main__':
main()