MCPcopy Index your code
hub / github.com/geekcomputers/Python / dealer_choice

Function dealer_choice

BlackJack_game/blackjack.py:69–103  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

67
68# function to show the dealer's choice
69def dealer_choice():
70 if sum(d_cards) < 17:
71 while sum(d_cards) < 17:
72 random.shuffle(deck)
73 d_cards.append(deck.pop())
74
75 print("Dealer has total " + str(sum(d_cards)) + "with the cards ", d_cards)
76
77 if sum(p_cards) == sum(d_cards):
78 print(f"{'*' * 15}The match is tie !!{'*' * 15}")
79 exit()
80
81 if sum(d_cards) == 21:
82 if sum(p_cards) < 21:
83 print(f"{'*' * 23}Dealer is the Winner !!{'*' * 18}")
84 elif sum(p_cards) == 21:
85 print(f"{'*' * 20}There is tie !!{'*' * 26}")
86 else:
87 print(f"{'*' * 23}Dealer is the Winner !!{'*' * 18}")
88
89 elif sum(d_cards) < 21:
90 if sum(p_cards) < 21 and sum(p_cards) < sum(d_cards):
91 print(f"{'*' * 23}Dealer is the Winner !!{'*' * 18}")
92 if sum(p_cards) == 21:
93 print(f"{'*' * 22}Player is winner !!{'*' * 22}")
94 if 21 > sum(p_cards) > sum(d_cards):
95 print(f"{'*' * 22}Player is winner !!{'*' * 22}")
96
97 else:
98 if sum(p_cards) < 21:
99 print(f"{'*' * 22}Player is winner !!{'*' * 22}")
100 elif sum(p_cards) == 21:
101 print(f"{'*' * 22}Player is winner !!{'*' * 22}")
102 else:
103 print(f"{'*' * 23}Dealer is the Winner !!{'*' * 18}")
104
105
106while sum(p_cards) < 21:

Callers 1

blackjack.pyFile · 0.70

Calls 4

exitFunction · 0.85
shuffleMethod · 0.45
appendMethod · 0.45
popMethod · 0.45

Tested by

no test coverage detected