🐛 Splitting

This commit is contained in:
Nikolaj Danger
2020-08-04 15:08:36 +02:00
parent 1c2b800d9c
commit 9db8ba3dcd
4 changed files with 256 additions and 263 deletions

View File

@ -371,188 +371,187 @@ async def parseCommands(message,content):
# Runs a game of Blackjack
elif content.startswith("blackjack"):
#try:
# Starts the game
if content == "blackjack" or content == "blackjack ":
cardsLeft = 0
if os.path.exists("resources/games/blackjackCards/"+str(message.channel)+".txt"):
with open("resources/games/blackjackCards/"+str(message.channel)+".txt","r") as f:
for _ in f:
cardsLeft += 1
try:
# Starts the game
if content == "blackjack" or content == "blackjack ":
cardsLeft = 0
if os.path.exists("resources/games/blackjackCards/"+str(message.channel)+".txt"):
with open("resources/games/blackjackCards/"+str(message.channel)+".txt","r") as f:
for _ in f:
cardsLeft += 1
# Shuffles if not enough cards
if cardsLeft < blackjackMinCards:
# Shuffles if not enough cards
if cardsLeft < blackjackMinCards:
blackjackShuffle(blackjackDecks,str(message.channel))
logThis("Shuffling the blackjack deck...",str(message.channel))
await message.channel.send("Shuffling the deck...")
new_message = blackjackStart(str(message.channel))
if new_message == "started":
new_message = "Blackjack game started. Use \""+commandPrefix+"blackjack bet [amount]\" to enter the game within the next 30 seconds."
await message.channel.send(new_message)
oldImage = await message.channel.send(file = discord.File("resources/games/blackjackTables/blackjackTable"+str(message.channel)+".png"))
with open("resources/games/oldImages/blackjack"+str(message.channel), "w") as f:
f.write(str(oldImage.id))
await asyncio.sleep(30)
gamedone = False
with open("resources/games/games.json", "r") as f:
data = json.load(f)
if len(data["blackjack games"][str(message.channel)]["user hands"]) == 0:
gamedone = True
await message.channel.send("No one entered the game. Ending the game.")
gameID = data["blackjack games"][str(message.channel)]["id"]
# Loop of game rounds
if gamedone == False:
logThis("!blackjack calling blackjackLoop()",str(message.channel))
await blackjackLoop(message.channel,1,gameID)
else:
new_message = blackjackFinish(str(message.channel))
await message.channel.send(new_message)
else:
await message.channel.send(new_message)
# Entering game and placing bet
elif content.startswith("blackjack bet"):
commands = content.split(" ")
try:
amount = int(commands[2])
except:
logThis("I didn't understand that",str(message.channel))
response = "I didn't understand that"
else:
response = blackjackPlayerDrawHand(str(message.channel),message.author.display_name,amount)
await message.channel.send(response)
# Hitting
elif content.startswith("blackjack hit"):
if content == "blackjack hit" or content == "blackjack hit ":
response = blackjackHit(str(message.channel),message.author.display_name)
else:
commands = content.split(" ")
try:
handNumber = int(commands[2])
except:
handNumber = 0
response = blackjackHit(str(message.channel),message.author.display_name,handNumber)
if response.startswith("accept"):
await message.add_reaction("👍")
try:
if response[6] == "T":
with open("resources/games/games.json", "r") as f:
gameID = json.load(f)["blackjack games"][str(message.channel)]["id"]
logThis("Hit calling blackjackLoop()",str(message.channel))
await blackjackLoop(message.channel,int(response[7:])+1,gameID)
except:
logThis("Something fucked up (error code 1320)",str(message.channel))
else:
await message.channel.send(response)
# Standing
elif content.startswith("blackjack stand"):
if content == "blackjack hit" or content == "blackjack hit ":
response = blackjackStand(str(message.channel),message.author.display_name)
else:
commands = content.split(" ")
try:
handNumber = int(commands[2])
except:
handNumber = 0
response = blackjackStand(str(message.channel),message.author.display_name,handNumber)
if response.startswith("accept"):
await message.add_reaction("👍")
try:
if response[6] == "T":
with open("resources/games/games.json", "r") as f:
gameID = json.load(f)["blackjack games"][str(message.channel)]["id"]
logThis("Stand calling blackjackLoop()",str(message.channel))
await blackjackLoop(message.channel,int(response[7:])+1,gameID)
except:
logThis("Something fucked up (error code 1320)",str(message.channel))
else:
await message.channel.send(response)
# Doubling bet
elif content.startswith("blackjack double"):
commands = content.split(" ")
try:
handNumber = int(commands[2])
except:
handNumber = 0
response, roundDone = blackjackDouble(str(message.channel),message.author.display_name,handNumber)
await message.channel.send(response)
try:
if roundDone[0] == "T":
with open("resources/games/games.json", "r") as f:
gameID = json.load(f)["blackjack games"][str(message.channel)]["id"]
logThis("Double calling blackjackLoop()",str(message.channel))
await blackjackLoop(message.channel,int(roundDone[1:])+1,gameID)
except:
logThis("Something fucked up (error code 1320)",str(message.channel))
# Splitting hand
elif content.startswith("blackjack split"):
commands = content.split(" ")
try:
handNumber = int(commands[2])
except:
handNumber = 0
response, roundDone = blackjackSplit(str(message.channel),message.author.display_name,handNumber)
await message.channel.send(response)
try:
if roundDone[0] == "T":
with open("resources/games/games.json", "r") as f:
gameID = json.load(f)["blackjack games"][str(message.channel)]["id"]
logThis("Split calling blackjackLoop()",str(message.channel))
await blackjackLoop(message.channel,int(roundDone[1:])+1,gameID)
except:
logThis("Something fucked up (error code 1320)")
# Returning current hi-lo value
elif content.startswith("blackjack hilo") and message.author.display_name == "Nikolaj":
if os.path.exists("resources/games/blackjackCards/"+str(message.channel)+".txt"):
with open("resources/games/hilo/"+str(message.channel)+".txt", "r") as f:
data = f.read()
else:
data = "0"
await message.channel.send(data)
# Shuffles the blackjack deck
elif content.startswith("blackjack shuffle"):
blackjackShuffle(blackjackDecks,str(message.channel))
logThis("Shuffling the blackjack deck...",str(message.channel))
await message.channel.send("Shuffling the deck...")
new_message = blackjackStart(str(message.channel))
if new_message == "started":
new_message = "Blackjack game started. Use \""+commandPrefix+"blackjack bet [amount]\" to enter the game within the next 30 seconds."
await message.channel.send(new_message)
oldImage = await message.channel.send(file = discord.File("resources/games/blackjackTables/blackjackTable"+str(message.channel)+".png"))
# Tells you the amount of cards left
elif content.startswith("blackjack cards"):
cardsLeft = 0
if os.path.exists("resources/games/blackjackCards/"+str(message.channel)+".txt"):
with open("resources/games/blackjackCards/"+str(message.channel)+".txt","r") as f:
for _ in f:
cardsLeft += 1
with open("resources/games/oldImages/blackjack"+str(message.channel), "w") as f:
f.write(str(oldImage.id))
decksLeft = round(cardsLeft/52,1)
await message.channel.send(str(cardsLeft)+" cards, "+str(decksLeft)+" decks")
await asyncio.sleep(30)
gamedone = False
with open("resources/games/games.json", "r") as f:
data = json.load(f)
if len(data["blackjack games"][str(message.channel)]["user hands"]) == 0:
gamedone = True
await message.channel.send("No one entered the game. Ending the game.")
gameID = data["blackjack games"][str(message.channel)]["id"]
# Loop of game rounds
if gamedone == False:
logThis("!blackjack calling blackjackLoop()",str(message.channel))
await blackjackLoop(message.channel,1,gameID)
else:
new_message = blackjackFinish(str(message.channel))
await message.channel.send(new_message)
else:
await message.channel.send(new_message)
# Entering game and placing bet
elif content.startswith("blackjack bet"):
commands = content.split(" ")
try:
amount = int(commands[2])
except:
logThis("I didn't understand that",str(message.channel))
response = "I didn't understand that"
else:
response = blackjackPlayerDrawHand(str(message.channel),message.author.display_name,amount)
await message.channel.send(response)
# Hitting
elif content.startswith("blackjack hit"):
if content == "blackjack hit" or content == "blackjack hit ":
response = blackjackHit(str(message.channel),message.author.display_name)
else:
commands = content.split(" ")
try:
handNumber = int(commands[2])
except:
handNumber = 0
response = blackjackHit(str(message.channel),message.author.display_name,handNumber)
if response.startswith("accept"):
await message.add_reaction("👍")
try:
if response[6] == "T":
with open("resources/games/games.json", "r") as f:
gameID = json.load(f)["blackjack games"][str(message.channel)]["id"]
logThis("Hit calling blackjackLoop()",str(message.channel))
await blackjackLoop(message.channel,int(response[7:])+1,gameID)
except:
logThis("Something fucked up",str(message.channel))
else:
await message.channel.send(response)
# Standing
elif content.startswith("blackjack stand"):
if content == "blackjack hit" or content == "blackjack hit ":
response = blackjackStand(str(message.channel),message.author.display_name)
else:
commands = content.split(" ")
try:
handNumber = int(commands[2])
except:
handNumber = 0
response = blackjackStand(str(message.channel),message.author.display_name,handNumber)
if response.startswith("accept"):
await message.add_reaction("👍")
try:
if response[6] == "T":
with open("resources/games/games.json", "r") as f:
gameID = json.load(f)["blackjack games"][str(message.channel)]["id"]
logThis("Stand calling blackjackLoop()",str(message.channel))
await blackjackLoop(message.channel,int(response[7:])+1,gameID)
except:
logThis("Something fucked up",str(message.channel))
await message.channel.send("something fucked up")
else:
await message.channel.send(response)
# Doubling bet
elif content.startswith("blackjack double"):
commands = content.split(" ")
try:
handNumber = int(commands[2])
except:
handNumber = 0
response, roundDone = blackjackDouble(str(message.channel),message.author.display_name,handNumber)
await message.channel.send(response)
try:
if roundDone[0] == "T":
with open("resources/games/games.json", "r") as f:
gameID = json.load(f)["blackjack games"][str(message.channel)]["id"]
logThis("Double calling blackjackLoop()",str(message.channel))
await blackjackLoop(message.channel,int(roundDone[1:])+1,gameID)
except:
logThis("Something fucked up",str(message.channel))
# Splitting hand
elif content.startswith("blackjack split"):
commands = content.split(" ")
try:
handNumber = int(commands[2])
except:
handNumber = 0
response, roundDone = blackjackSplit(str(message.channel),message.author.display_name,handNumber)
await message.channel.send(response)
try:
if roundDone[0] == "T":
with open("resources/games/games.json", "r") as f:
gameID = json.load(f)["blackjack games"][str(message.channel)]["id"]
logThis("Split calling blackjackLoop()",str(message.channel))
await blackjackLoop(message.channel,int(roundDone[1:])+1,gameID)
except:
logThis("Something fucked up")
# Returning current hi-lo value
elif content.startswith("blackjack hilo") and message.author.display_name == "Nikolaj":
if os.path.exists("resources/games/blackjackCards/"+str(message.channel)+".txt"):
with open("resources/games/hilo/"+str(message.channel)+".txt", "r") as f:
data = f.read()
else:
data = "0"
await message.channel.send(data)
# Shuffles the blackjack deck
elif content.startswith("blackjack shuffle"):
blackjackShuffle(blackjackDecks,str(message.channel))
logThis("Shuffling the blackjack deck...",str(message.channel))
await message.channel.send("Shuffling the deck...")
# Tells you the amount of cards left
elif content.startswith("blackjack cards"):
cardsLeft = 0
if os.path.exists("resources/games/blackjackCards/"+str(message.channel)+".txt"):
with open("resources/games/blackjackCards/"+str(message.channel)+".txt","r") as f:
for _ in f:
cardsLeft += 1
decksLeft = round(cardsLeft/52,1)
await message.channel.send(str(cardsLeft)+" cards, "+str(decksLeft)+" decks")
else:
logThis("Not a command (error code 1301)")
await message.channel.send("I didn't quite understand that (error code 1301)")
#except:
# logThis("Something went wrong (error code 1300)")
logThis("Not a command (error code 1301)")
await message.channel.send("I didn't quite understand that (error code 1301)")
except:
logThis("Something went wrong (error code 1300)")
# Runs a game of four in a row
elif content.startswith("fourinarow"):
@ -595,14 +594,14 @@ async def on_ready():
# Reads messages and tests if they are Gwendolyn commands
@client.event
async def on_message(message):
#try:
content = message.content
if content.startswith(commandPrefix):
logThis(message.author.display_name+" ran \""+content+"\"",str(message.channel))
await parseCommands(message,content.lower()[1:])
#except:
# logThis("Something fucked up (error code 000)")
# await message.channel.send("Something fucked up (error code 000)")
try:
content = message.content
if content.startswith(commandPrefix):
logThis(message.author.display_name+" ran \""+content+"\"",str(message.channel))
await parseCommands(message,content.lower()[1:])
except:
logThis("Something fucked up (error code 000)")
await message.channel.send("Something fucked up (error code 000)")
# Is a bit sassy sometimes
if ("gwendolyn" in message.content.lower() or message.content.startswith(commandPrefix)) and any(x in message.content.lower() for x in meanWords) and "ikke" not in message.content.lower() and "not" not in message.content.lower():

View File

@ -132,61 +132,12 @@ def blackjackContinue(channel):
with open("resources/games/games.json", "r") as f:
data = json.load(f)
logThis("Testing if all are standing")
for user in data["blackjack games"][channel]["user hands"]:
if data["blackjack games"][channel]["user hands"][user]["hit"] == False:
data["blackjack games"][channel]["user hands"][user]["standing"] = True
if data["blackjack games"][channel]["user hands"][user]["standing"] == False:
allStanding = False
if calcHandValue(data["blackjack games"][channel]["user hands"][user]["hand"]) >= 21 or data["blackjack games"][channel]["user hands"][user]["doubled"]:
data["blackjack games"][channel]["user hands"][user]["standing"] = True
else:
preAllStanding = False
data["blackjack games"][channel]["user hands"][user]["hit"] = False
if data["blackjack games"][channel]["user hands"][user]["split"] > 0:
if data["blackjack games"][channel]["user hands"][user]["other hand"]["hit"] == False:
data["blackjack games"][channel]["user hands"][user]["other hand"]["standing"] = True
if data["blackjack games"][channel]["user hands"][user]["other hand"]["standing"] == False:
allStanding = False
if calcHandValue(data["blackjack games"][channel]["user hands"][user]["other hand"]["hand"]) >= 21 or data["blackjack games"][channel]["user hands"][user]["other hand"]["doubled"]:
data["blackjack games"][channel]["user hands"][user]["other hand"]["standing"] = True
else:
preAllStanding = False
data["blackjack games"][channel]["user hands"][user]["other hand"]["hit"] = False
if data["blackjack games"][channel]["user hands"][user]["split"] > 1:
if data["blackjack games"][channel]["user hands"][user]["third hand"]["hit"] == False:
data["blackjack games"][channel]["user hands"][user]["third hand"]["standing"] = True
if data["blackjack games"][channel]["user hands"][user]["third hand"]["standing"] == False:
allStanding = False
if calcHandValue(data["blackjack games"][channel]["user hands"][user]["third hand"]["hand"]) >= 21 or data["blackjack games"][channel]["user hands"][user]["third hand"]["doubled"]:
data["blackjack games"][channel]["user hands"][user]["third hand"]["standing"] = True
else:
preAllStanding = False
data["blackjack games"][channel]["user hands"][user]["third hand"]["hit"] = False
if data["blackjack games"][channel]["user hands"][user]["split"] > 2:
if data["blackjack games"][channel]["user hands"][user]["fourth hand"]["hit"] == False:
data["blackjack games"][channel]["user hands"][user]["fourth hand"]["standing"] = True
if data["blackjack games"][channel]["user hands"][user]["fourth hand"]["standing"] == False:
allStanding = False
if calcHandValue(data["blackjack games"][channel]["user hands"][user]["fourth hand"]["hand"]) >= 21 or data["blackjack games"][channel]["user hands"][user]["fourth hand"]["doubled"]:
data["blackjack games"][channel]["user hands"][user]["fourth hand"]["standing"] = True
else:
preAllStanding = False
data["blackjack games"][channel]["user hands"][user]["fourth hand"]["hit"] = False
try:
data["blackjack games"][channel]["user hands"][user], allStanding, preAllStanding = testIfStanding(data["blackjack games"][channel]["user hands"][user],allStanding,preAllStanding,True)
except:
logThis("Error in testing if all are standing (error code 1331)")
if allStanding:
data["blackjack games"][channel]["all standing"] = True
@ -196,7 +147,10 @@ def blackjackContinue(channel):
with open("resources/games/games.json", "w") as f:
json.dump(data,f,indent=4)
blackjackDraw.drawImage(channel)
try:
blackjackDraw.drawImage(channel)
except:
logThis("Error drawing blackjack table (error code 1340)")
if allStanding:
if done == False:
@ -212,6 +166,31 @@ def blackjackContinue(channel):
firstRoundMessage = ""
return "You have 2 minutes to either hit or stand with \"!blackjack hit\" or \"!blackjack stand\""+firstRoundMessage+". It's assumed you're standing if you don't make a choice.", False, done
def testIfStanding(hand,allStanding,preAllStanding,topLevel):
if hand["hit"] == False:
hand["standing"] = True
if hand["standing"] == False:
allStanding = False
if calcHandValue(hand["hand"]) >= 21 or hand["doubled"]:
hand["standing"] = True
else:
preAllStanding = False
hand["hit"] = False
if topLevel:
if hand["split"] >= 1:
hand["other hand"], allstanding, preAllStanding = testIfStanding(hand["other hand"],allStanding,preAllStanding,False)
if hand["split"] >= 2:
hand["third hand"], allstanding, preAllStanding = testIfStanding(hand["third hand"],allStanding,preAllStanding,False)
if hand["split"] >= 3:
hand["fourth hand"], allstanding, preAllStanding = testIfStanding(hand["fourth hand"],allStanding,preAllStanding,False)
return hand, allStanding, preAllStanding
# When players try to hit
def blackjackHit(channel,user,handNumber = 0):
with open("resources/games/games.json", "r") as f:
@ -311,7 +290,7 @@ def blackjackDouble(channel,user,handNumber = 0):
hand = data["blackjack games"][channel]["user hands"][user]["other hand"]
elif handNumber == 3:
hand = data["blackjack games"][channel]["user hands"][user]["third hand"]
elif handNumber == 3:
elif handNumber == 4:
hand = data["blackjack games"][channel]["user hands"][user]["fourth hand"]
else:
logThis(user+" tried to double without specifying which hand")

View File

@ -1,12 +1,13 @@
import json
from PIL import Image, ImageDraw, ImageFont
from funcs import logThis
border = 100
placement = [0,0]
rotation = 0
def drawImage(channel):
logThis("Drawing blackjack table",channel)
with open("resources/games/games.json", "r") as f:
data = json.load(f)
@ -22,37 +23,43 @@ def drawImage(channel):
dealerBusted = data["blackjack games"][channel]["dealer busted"]
dealerBlackjack = data["blackjack games"][channel]["dealer blackjack"]
if data["blackjack games"][channel]["all standing"] == False:
dealerHand = drawHand(data["blackjack games"][channel]["dealer hand"],True,False,False)
else:
dealerHand = drawHand(data["blackjack games"][channel]["dealer hand"],False,dealerBusted,dealerBlackjack)
try:
if data["blackjack games"][channel]["all standing"] == False:
dealerHand = drawHand(data["blackjack games"][channel]["dealer hand"],True,False,False)
else:
dealerHand = drawHand(data["blackjack games"][channel]["dealer hand"],False,dealerBusted,dealerBlackjack)
except:
logThis("Error drawing dealer hand (error code 1341a)")
table.paste(dealerHand,(800-borderSmol,20-borderSmol),dealerHand)
for x in range(len(hands)):
key, value = list(hands.items())[x]
logThis("drawing "+key+"'s hand")
userHand = drawHand(value["hand"],False,value["busted"],value["blackjack"])
if value["split"] == 3:
table.paste(userHand,(32-borderSmol+(384*placement[x]),280-borderSmol),userHand)
userOtherHand = drawHand(value["other hand"]["hand"],False,value["other hand"]["busted"],value["other hand"]["blackjack"])
table.paste(userOtherHand,(32-borderSmol+(384*placement[x]),420-borderSmol),userOtherHand)
userThirdHand = drawHand(value["third hand"]["hand"],False,value["third hand"]["busted"],value["third hand"]["blackjack"])
table.paste(userThirdHand,(32-borderSmol+(384*placement[x]),560-borderSmol),userOtherHand)
userFourthHand = drawHand(value["fourth hand"]["hand"],False,value["fourth hand"]["busted"],value["fourth hand"]["blackjack"])
table.paste(userFourthHand,(32-borderSmol+(384*placement[x]),700-borderSmol),userOtherHand)
elif value["split"] == 2:
table.paste(userHand,(32-borderSmol+(384*placement[x]),420-borderSmol),userHand)
userOtherHand = drawHand(value["other hand"]["hand"],False,value["other hand"]["busted"],value["other hand"]["blackjack"])
table.paste(userOtherHand,(32-borderSmol+(384*placement[x]),560-borderSmol),userOtherHand)
userThirdHand = drawHand(value["third hand"]["hand"],False,value["third hand"]["busted"],value["third hand"]["blackjack"])
table.paste(userThirdHand,(32-borderSmol+(384*placement[x]),700-borderSmol),userOtherHand)
elif value["split"] == 1:
table.paste(userHand,(32-borderSmol+(384*placement[x]),560-borderSmol),userHand)
userOtherHand = drawHand(value["other hand"]["hand"],False,value["other hand"]["busted"],value["other hand"]["blackjack"])
table.paste(userOtherHand,(32-borderSmol+(384*placement[x]),700-borderSmol),userOtherHand)
else:
table.paste(userHand,(32-borderSmol+(384*placement[x]),680-borderSmol),userHand)
try:
if value["split"] == 3:
table.paste(userHand,(32-borderSmol+(384*placement[x]),280-borderSmol),userHand)
userOtherHand = drawHand(value["other hand"]["hand"],False,value["other hand"]["busted"],value["other hand"]["blackjack"])
table.paste(userOtherHand,(32-borderSmol+(384*placement[x]),420-borderSmol),userOtherHand)
userThirdHand = drawHand(value["third hand"]["hand"],False,value["third hand"]["busted"],value["third hand"]["blackjack"])
table.paste(userThirdHand,(32-borderSmol+(384*placement[x]),560-borderSmol),userThirdHand)
userFourthHand = drawHand(value["fourth hand"]["hand"],False,value["fourth hand"]["busted"],value["fourth hand"]["blackjack"])
table.paste(userFourthHand,(32-borderSmol+(384*placement[x]),700-borderSmol),userFourthHand)
elif value["split"] == 2:
table.paste(userHand,(32-borderSmol+(384*placement[x]),420-borderSmol),userHand)
userOtherHand = drawHand(value["other hand"]["hand"],False,value["other hand"]["busted"],value["other hand"]["blackjack"])
table.paste(userOtherHand,(32-borderSmol+(384*placement[x]),560-borderSmol),userOtherHand)
userThirdHand = drawHand(value["third hand"]["hand"],False,value["third hand"]["busted"],value["third hand"]["blackjack"])
table.paste(userThirdHand,(32-borderSmol+(384*placement[x]),700-borderSmol),userThirdHand)
elif value["split"] == 1:
table.paste(userHand,(32-borderSmol+(384*placement[x]),560-borderSmol),userHand)
userOtherHand = drawHand(value["other hand"]["hand"],False,value["other hand"]["busted"],value["other hand"]["blackjack"])
table.paste(userOtherHand,(32-borderSmol+(384*placement[x]),700-borderSmol),userOtherHand)
else:
table.paste(userHand,(32-borderSmol+(384*placement[x]),680-borderSmol),userHand)
except:
logThis("Error drawing player hands (error code 1341b)")
textWidth = fnt.getsize(key)[0]
if textWidth < 360:
@ -69,11 +76,13 @@ def drawImage(channel):
textImage.text((32+(384*placement[x])+117-int(textWidth/2)+2,1020+2),key,fill=(0,0,0), font=fntSmol)
textImage.text((32+(384*placement[x])+117-int(textWidth/2),1015),key,fill=(255,255,255), font=fntSmol)
logThis("Saving table image")
table.save("resources/games/blackjackTables/blackjackTable"+channel+".png")
return
def drawHand(hand, dealer, busted, blackjack):
logThis("Drawing hand "+str(hand))
fnt = ImageFont.truetype('resources/futura-bold.ttf', 200)
fnt2 = ImageFont.truetype('resources/futura-bold.ttf', 120)
length = len(hand)
@ -102,6 +111,7 @@ def drawHand(hand, dealer, busted, blackjack):
w, h = background.size
textHeight = 290+border
#logThis("Drawing busted/blackjack")
if busted:
textWidth = fnt.getsize("BUSTED")[0]
textImage.text((int(w/2)-int(textWidth/2)-10,textHeight+20-10),"BUSTED",fill=(0,0,0), font=fnt)
@ -125,4 +135,5 @@ def drawHand(hand, dealer, busted, blackjack):
textImage.text((int(w/2)-int(textWidth/2)+3,textHeight+3),"BLACKJACK",fill=(255,255,255), font=fnt2)
textImage.text((int(w/2)-int(textWidth/2),textHeight),"BLACKJACK",fill=(155,123,0), font=fnt2)
#logThis("Returning resized image")
return background.resize((int(w/3.5),int(h/3.5)),resample=Image.BILINEAR)

View File

@ -93,6 +93,10 @@
1312 - Error in calcWinnings function
1320 - Unspecified loop error
1321 - Loop interrupted while waiting
1330 - Unspecified continue error
1331 - Error in testIfStanding()
1340 - Error in drawing blackjack table
1341 - Error in drawHand()
14 - Four in a row
1400 - Unspecified error