✨ Added shuffle and hilo commands
This commit is contained in:
@ -56,12 +56,23 @@ def drawCard():
|
||||
logThis("drawing a card")
|
||||
with open("resources/games/blackjackCards.txt","r") as f:
|
||||
cards = f.read().split("\n")
|
||||
with open("resources/games/hilo.txt", "r") as f:
|
||||
data = int(f.read())
|
||||
|
||||
drawnCard = cards.pop(0)
|
||||
data = "\n".join(cards)
|
||||
deck = "\n".join(cards)
|
||||
|
||||
value = calcHandValue([drawnCard])
|
||||
|
||||
if value <= 6:
|
||||
data += 1
|
||||
elif value >= 10:
|
||||
data -= 1
|
||||
|
||||
with open("resources/games/blackjackCards.txt","w") as f:
|
||||
f.write(data)
|
||||
f.write(deck)
|
||||
with open("resources/games/hilo.txt", "w") as f:
|
||||
f.write(str(data))
|
||||
|
||||
return drawnCard
|
||||
|
||||
|
@ -165,6 +165,17 @@ def makeFiles():
|
||||
finally:
|
||||
f.close()
|
||||
|
||||
# Creates blackjackCards.txt if it doesn't exist
|
||||
try:
|
||||
f = open("resources/games/hilo.txt","r")
|
||||
except:
|
||||
logThis("hilo.txt didn't exist. Making it now.")
|
||||
data = ""
|
||||
with open("resources/games/hilo.txt","w") as f:
|
||||
f.write(data)
|
||||
finally:
|
||||
f.close()
|
||||
|
||||
# Creates destinyPoints.txt if it doesn't exist
|
||||
try:
|
||||
f = open("resources/destinyPoints.txt","r")
|
||||
|
Reference in New Issue
Block a user