This commit is contained in:
Nikolaj Danger
2020-08-14 11:34:44 +02:00
parent 0f633af4b9
commit 4b560bf1b9

View File

@ -36,7 +36,8 @@ class Blackjack():
# Calculates the value of a blackjack hand # Calculates the value of a blackjack hand
def calcHandValue(self, hand : list): def calcHandValue(self, hand : list):
logThis("Calculating hand value") logThis("Calculating hand value")
values = [0] values = []
values.append(0)
for card in hand: for card in hand:
cardValue = card[0] cardValue = card[0]
@ -47,8 +48,9 @@ class Blackjack():
values.append(values[x] + 11) values.append(values[x] + 11)
values[x] += 1 values[x] += 1
else: else:
for value in values: for x in range(len(values)):
value += int(cardValue) values[x] += int(cardValue)
print(values[x])
values.sort() values.sort()