Split in blackjack

This commit is contained in:
NikolajDanger
2020-07-28 17:59:43 +02:00
parent 586cbc3d87
commit 4bd156b576
5 changed files with 258 additions and 63 deletions

View File

@ -348,7 +348,7 @@ async def on_message(message):
if allStanding: if allStanding:
await asyncio.sleep(5) await asyncio.sleep(5)
else: else:
await asyncio.sleep(20) await asyncio.sleep(30)
new_message = funcs.blackjackFinish(str(message.channel)) new_message = funcs.blackjackFinish(str(message.channel))
await message.channel.send(new_message) await message.channel.send(new_message)
@ -357,7 +357,7 @@ async def on_message(message):
else: else:
await message.channel.send(new_message) await message.channel.send(new_message)
if message.content.lower().startswith("!blackjack bet"): elif message.content.lower().startswith("!blackjack bet"):
commands = message.content.lower().split(" ") commands = message.content.lower().split(" ")
try: try:
amount = int(commands[2]) amount = int(commands[2])
@ -368,25 +368,50 @@ async def on_message(message):
response = funcs.blackjackPlayerDrawHand(str(message.channel),message.author.display_name,amount) response = funcs.blackjackPlayerDrawHand(str(message.channel),message.author.display_name,amount)
await message.channel.send(response) await message.channel.send(response)
if message.content.lower().startswith("!blackjack hit"): elif message.content.lower().startswith("!blackjack hit"):
response = funcs.blackjackHit(str(message.channel),message.author.display_name) if message.content.lower() == "!blackjack hit" or message.content.lower() == "!blackjack hit ":
response = funcs.blackjackHit(str(message.channel),message.author.display_name)
else:
commands = message.content.lower().split(" ")
try:
handNumber = int(commands[2])
except:
handNumber = 0
response = funcs.blackjackHit(str(message.channel),message.author.display_name,handNumber)
if response == "accept":
await message.add_reaction("👍")
else:
await message.channel.send(response)
elif message.content.lower().startswith("!blackjack stand"):
response = funcs.blackjackStand(str(message.channel),message.author.display_name,0)
if response == "accept": if response == "accept":
await message.add_reaction("👍") await message.add_reaction("👍")
else: else:
await message.channel.send(response) await message.channel.send(response)
if message.content.lower().startswith("!blackjack stand"): elif message.content.lower().startswith("!blackjack double"):
response = funcs.blackjackStand(str(message.channel),message.author.display_name) if message.content.lower() == "!blackjack hit" or message.content.lower() == "!blackjack hit ":
if response == "accept": response = funcs.blackjackDouble(str(message.channel),message.author.display_name)
await message.add_reaction("👍")
else: else:
commands = message.content.lower().split(" ")
try:
handNumber = int(commands[2])
except:
handNumber = 0
response = funcs.blackjackDouble(str(message.channel),message.author.display_name,handNumber)
await message.channel.send(response) await message.channel.send(response)
if message.content.lower().startswith("!blackjack double"): elif message.content.lower().startswith("!blackjack split"):
response = funcs.blackjackDouble(str(message.channel),message.author.display_name) response = funcs.blackjackSplit(str(message.channel),message.author.display_name)
await message.channel.send(response) await message.channel.send(response)
else:
await message.channel.send("I didn't quite understand that")
# Is a bit sassy sometimes # Is a bit sassy sometimes
meanWords = ["stupid", "bitch", "fuck", "dumb", "idiot"] meanWords = ["stupid", "bitch", "fuck", "dumb", "idiot"]

View File

@ -6,6 +6,6 @@ from .lookup import spellFunc, monsterFunc
from .other import nameGen, tavernGen, movieFunc from .other import nameGen, tavernGen, movieFunc
from .games import triviaStart, triviaOtherThing, triviaCountPoints, checkBalance, addMoney, giveMoney, shuffle, blackjackStart, blackjackPlayerDrawHand, blackjackContinue, blackjackFinish, blackjackStand, blackjackHit,blackjackDouble from .games import triviaStart, triviaOtherThing, triviaCountPoints, checkBalance, addMoney, giveMoney, shuffle, blackjackStart, blackjackPlayerDrawHand, blackjackContinue, blackjackFinish, blackjackStand, blackjackHit,blackjackDouble,blackjackSplit
from .roll import roll_dice from .roll import roll_dice

View File

@ -1,3 +1,3 @@
from .money import checkBalance, giveMoney, addMoney from .money import checkBalance, giveMoney, addMoney
from .trivia import triviaCountPoints, triviaStart, triviaOtherThing from .trivia import triviaCountPoints, triviaStart, triviaOtherThing
from .blackjack import shuffle, blackjackStart, blackjackPlayerDrawHand, blackjackContinue, blackjackFinish, blackjackHit, blackjackStand, blackjackDouble from .blackjack import shuffle, blackjackStart, blackjackPlayerDrawHand, blackjackContinue, blackjackFinish, blackjackHit, blackjackStand, blackjackDouble, blackjackSplit

View File

@ -125,6 +125,20 @@ def blackjackContinue(channel):
data["blackjack games"][channel]["user hands"][user]["hit"] = False data["blackjack games"][channel]["user hands"][user]["hit"] = False
if data["blackjack games"][channel]["user hands"][user]["split"]:
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 allStanding: if allStanding:
data["blackjack games"][channel]["all standing"] = True data["blackjack games"][channel]["all standing"] = True
with open("resources/games/games.json", "w") as f: with open("resources/games/games.json", "w") as f:
@ -143,24 +157,49 @@ def blackjackContinue(channel):
elif preAllStanding: elif preAllStanding:
return "", True, done return "", True, done
else: else:
return "You have 20 seconds to either hit or stand with \"!blackjack hit\" or \"!blackjack stand\". You can also double down with \"!blackjack double\". It's assumed you're standing if you don't make a choice.", False, done if data["blackjack games"][channel]["round"] == 1:
firstRoundMessage = ". You can also double down with \"!blackjack double\" or split with \"!blackjack split\""
else:
firstRoundMessage = ""
return "You have 30 seconds 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 blackjackHit(channel,user): def blackjackHit(channel,user,handNumber = 0):
with open("resources/games/games.json", "r") as f: with open("resources/games/games.json", "r") as f:
data = json.load(f) data = json.load(f)
if data["blackjack games"][channel]["user hands"][user]["split"] == False:
hand = data["blackjack games"][channel]["user hands"][user]
otherHand = False
else:
if handNumber != 0:
if handNumber == 1:
hand = data["blackjack games"][channel]["user hands"][user]
otherHand = False
elif handNumber == 2:
hand = data["blackjack games"][channel]["user hands"][user]["other hand"]
otherHand = True
else:
logThis(user+" tried to hit without specifying which hand")
return "You have to specify the hand you're hitting with."
else:
logThis(user+" tried to hit without specifying which hand")
return "You have to specify the hand you're hitting with."
if data["blackjack games"][channel]["round"] > 0: if data["blackjack games"][channel]["round"] > 0:
if data["blackjack games"][channel]["user hands"][user]["hit"] == False: if hand["hit"] == False:
if data["blackjack games"][channel]["user hands"][user]["standing"] == False: if hand["standing"] == False:
data["blackjack games"][channel]["user hands"][user]["hand"].append(drawCard()) hand["hand"].append(drawCard())
data["blackjack games"][channel]["user hands"][user]["hit"] = True hand["hit"] = True
handValue = calcHandValue(data["blackjack games"][channel]["user hands"][user]["hand"])
handValue = calcHandValue(hand["hand"])
if handValue > 21: if handValue > 21:
data["blackjack games"][channel]["user hands"][user]["busted"] = True hand["busted"] = True
if otherHand:
data["blackjack games"][channel]["user hands"][user]["other hand"] = hand
else:
data["blackjack games"][channel]["user hands"][user] = hand
with open("resources/games/games.json", "w") as f: with open("resources/games/games.json", "w") as f:
json.dump(data,f,indent=4) json.dump(data,f,indent=4)
@ -176,45 +215,71 @@ def blackjackHit(channel,user):
logThis(user+" tried to hit on the 0th round") logThis(user+" tried to hit on the 0th round")
return "You can't hit before you see your cards" return "You can't hit before you see your cards"
def blackjackDouble(channel,user):
def blackjackDouble(channel,user,handNumber = 0):
with open("resources/games/games.json", "r") as f: with open("resources/games/games.json", "r") as f:
data = json.load(f) data = json.load(f)
if data["blackjack games"][channel]["user hands"][user]["split"] == False:
hand = data["blackjack games"][channel]["user hands"][user]
otherHand = False
correctRound = 1
else:
if handNumber != 0:
if handNumber == 1:
hand = data["blackjack games"][channel]["user hands"][user]
otherHand = False
elif handNumber == 2:
hand = data["blackjack games"][channel]["user hands"][user]["other hand"]
otherHand = True
else:
logThis(user+" tried to double without specifying which hand")
return "You have to specify the hand you're doubling down."
else:
logThis(user+" tried to double without specifying which hand")
return "You have to specify the hand you're doubling down."
correctRound = 2
if data["blackjack games"][channel]["round"] > 0: if data["blackjack games"][channel]["round"] > 0:
if data["blackjack games"][channel]["user hands"][user]["hit"] == False: if hand["hit"] == False:
if data["blackjack games"][channel]["user hands"][user]["standing"] == False: if hand["standing"] == False:
if data["blackjack games"][channel]["round"] == 1: if data["blackjack games"][channel]["round"] == correctRound:
bet = data["blackjack games"][channel]["user hands"][user]["bet"] bet = hand["bet"]
if money.checkBalance(user) >= bet: if money.checkBalance(user) >= bet:
money.addMoney(user,-1 * bet) money.addMoney(user,-1 * bet)
with open("resources/games/games.json", "r") as f: with open("resources/games/games.json", "r") as f:
data = json.load(f) data = json.load(f)
data["blackjack games"][channel]["user hands"][user]["hand"].append(drawCard()) hand["hand"].append(drawCard())
data["blackjack games"][channel]["user hands"][user]["hit"] = True hand["hit"] = True
data["blackjack games"][channel]["user hands"][user]["doubled"] = True hand["doubled"] = True
data["blackjack games"][channel]["user hands"][user]["bet"] += bet hand["bet"] += bet
handValue = calcHandValue(data["blackjack games"][channel]["user hands"][user]["hand"]) handValue = calcHandValue(hand["hand"])
if handValue > 21: if handValue > 21:
data["blackjack games"][channel]["user hands"][user]["busted"] = True hand["busted"] = True
if otherHand:
data["blackjack games"][channel]["user hands"][user]["other hand"] = hand
else:
data["blackjack games"][channel]["user hands"][user] = hand
with open("resources/games/games.json", "w") as f: with open("resources/games/games.json", "w") as f:
json.dump(data,f,indent=4) json.dump(data,f,indent=4)
return "Adding another "+str(bet)+" GwendoBucks to "+user+"'s bet" return "Adding another "+str(bet)+" GwendoBucks to "+user+"'s bet and drawing another card."
else: else:
logThis(user+" doesn't have enough GwendoBucks") logThis(user+" doesn't have enough GwendoBucks")
return "You don't have enough GwendoBucks" return "You don't have enough GwendoBucks"
else: else:
logThis(user+" tried to double on round "+data["blackjack games"][channel]["user hands"][user]["round"]) logThis(user+" tried to double on round "+str(data["blackjack games"][channel]["round"]))
return "You can only double down on the first round" return "You can only double down on the first round"
else: else:
logThis(user+" is already standing") logThis(user+" is already standing")
return "You can't hit when you're standing" return "You can't double when you're standing"
else: else:
logThis(user+" has already hit this round") logThis(user+" has already hit this round")
return "You've already hit this round" return "You've already hit this round"
@ -222,13 +287,15 @@ def blackjackDouble(channel,user):
logThis(user+" tried to double on the 0th round") logThis(user+" tried to double on the 0th round")
return "You can't double down before you see your cards" return "You can't double down before you see your cards"
def blackjackStand(channel,user): def blackjackStand(channel,user,handNumber = 0):
with open("resources/games/games.json", "r") as f: with open("resources/games/games.json", "r") as f:
data = json.load(f) data = json.load(f)
hand = data["blackjack games"][channel]["user hands"][user]
if data["blackjack games"][channel]["round"] > 0: if data["blackjack games"][channel]["round"] > 0:
if data["blackjack games"][channel]["user hands"][user]["hit"] == False: if hand["hit"] == False:
if data["blackjack games"][channel]["user hands"][user]["standing"] == False: if hand["standing"] == False:
data["blackjack games"][channel]["user hands"][user]["standing"] = True hand["standing"] = True
with open("resources/games/games.json", "w") as f: with open("resources/games/games.json", "w") as f:
json.dump(data,f,indent=4) json.dump(data,f,indent=4)
@ -243,6 +310,70 @@ def blackjackStand(channel,user):
logThis(user+" tried to stand on the first round") logThis(user+" tried to stand on the first round")
return "You can't stand before you see your cards" return "You can't stand before you see your cards"
def blackjackSplit(channel,user):
with open("resources/games/games.json", "r") as f:
data = json.load(f)
if data["blackjack games"][channel]["round"] > 0:
if data["blackjack games"][channel]["user hands"][user]["hit"] == False:
if data["blackjack games"][channel]["user hands"][user]["standing"] == False:
if data["blackjack games"][channel]["round"] == 1:
firstCard = calcHandValue([data["blackjack games"][channel]["user hands"][user]["hand"][0]])
secondCard = calcHandValue([data["blackjack games"][channel]["user hands"][user]["hand"][1]])
if firstCard == secondCard:
bet = data["blackjack games"][channel]["user hands"][user]["bet"]
if money.checkBalance(user) >= bet:
money.addMoney(user,-1 * bet)
with open("resources/games/games.json", "r") as f:
data = json.load(f)
data["blackjack games"][channel]["user hands"][user]["hit"] = True
data["blackjack games"][channel]["user hands"][user]["other hand"]["hit"] = True
data["blackjack games"][channel]["user hands"][user]["split"] = True
data["blackjack games"][channel]["user hands"][user]["other hand"]["bet"] = data["blackjack games"][channel]["user hands"][user]["bet"]
data["blackjack games"][channel]["user hands"][user]["other hand"]["hand"].append(data["blackjack games"][channel]["user hands"][user]["hand"].pop(1))
data["blackjack games"][channel]["user hands"][user]["other hand"]["hand"].append(drawCard())
data["blackjack games"][channel]["user hands"][user]["hand"].append(drawCard())
handValue = calcHandValue(data["blackjack games"][channel]["user hands"][user]["hand"])
otherHandValue = calcHandValue(data["blackjack games"][channel]["user hands"][user]["other hand"]["hand"])
if handValue > 21:
data["blackjack games"][channel]["user hands"][user]["busted"] = True
elif handValue == 21:
data["blackjack games"][channel]["user hands"][user]["blackjack"] = True
if otherHandValue > 21:
data["blackjack games"][channel]["user hands"][user]["other hand"]["busted"] = True
elif otherHandValue == 21:
data["blackjack games"][channel]["user hands"][user]["other hand"]["blackjack"] = True
with open("resources/games/games.json", "w") as f:
json.dump(data,f,indent=4)
return "Splitting "+user+"'s hand into 2. Adding their original bet to the second hand. You can use \"!Blackjack hit/stand/double 1\" and \"!Blackjack hit/stand/double 2\" to play the different hands."
else:
logThis(user+" doesn't have enough GwendoBucks")
return "You don't have enough GwendoBucks"
else:
logThis(user+" tried to split 2 different cards")
return "Your cards need to have the same value to split"
else:
logThis(user+" tried to split on round "+data["blackjack games"][channel]["round"])
return "You can only split on the first round"
else:
logThis(user+" is already standing")
return "You can't split when you're standing"
else:
logThis(user+" has already hit this round")
return "You've already hit this round"
else:
logThis(user+" tried to split on the 0th round")
return "You can't split before you see your cards"
def blackjackPlayerDrawHand(channel,user,bet): def blackjackPlayerDrawHand(channel,user,bet):
with open("resources/games/games.json", "r") as f: with open("resources/games/games.json", "r") as f:
data = json.load(f) data = json.load(f)
@ -264,9 +395,17 @@ def blackjackPlayerDrawHand(channel,user,bet):
data = json.load(f) data = json.load(f)
if handValue == 21: if handValue == 21:
data["blackjack games"][channel]["user hands"][user] = {"hand":playerHand,"bet":bet,"standing":False,"busted":False,"blackjack":True,"hit":True,"doubled":False} data["blackjack games"][channel]["user hands"][user] = {"hand":playerHand,
"bet":bet,"standing":False,"busted":False,"blackjack":True,"hit":True,
"doubled":False,"split":False,"other hand":{
"hand":[],"bet":0,"standing":False,"busted":False,"blackjack":False,"hit":True,
"doubled":False}}
else: else:
data["blackjack games"][channel]["user hands"][user] = {"hand":playerHand,"bet":bet,"standing":False,"busted":False,"blackjack":False,"hit":True,"doubled":False} data["blackjack games"][channel]["user hands"][user] = {"hand":playerHand,
"bet":bet,"standing":False,"busted":False,"blackjack":False,"hit":True,
"doubled":False,"split":False,"other hand":{
"hand":[],"bet":0,"standing":False,"busted":False,"blackjack":False,"hit":True,
"doubled":False}}
with open("resources/games/games.json", "w") as f: with open("resources/games/games.json", "w") as f:
json.dump(data,f,indent=4) json.dump(data,f,indent=4)
@ -341,9 +480,33 @@ def blackjackFinish(channel):
elif calcHandValue(data["blackjack games"][channel]["user hands"][user]["hand"]) == dealerValue: elif calcHandValue(data["blackjack games"][channel]["user hands"][user]["hand"]) == dealerValue:
reason = "(pushed)" reason = "(pushed)"
winnings += data["blackjack games"][channel]["user hands"][user]["bet"] winnings += data["blackjack games"][channel]["user hands"][user]["bet"]
else:
reason = "(highest value)"
else: else:
reason = "(busted)" reason = "(busted)"
if data["blackjack games"][channel]["user hands"][user]["split"]:
winnings -= data["blackjack games"][channel]["user hands"][user]["other hand"]["bet"]
if data["blackjack games"][channel]["user hands"][user]["other hand"]["blackjack"] and data["blackjack games"][channel]["dealer blackjack"] == False:
reason += "(blackjack)"
winnings += math.floor(2.5 * data["blackjack games"][channel]["user hands"][user]["other hand"]["bet"])
else:
if data["blackjack games"][channel]["user hands"][user]["other hand"]["busted"] == False:
if data["blackjack games"][channel]["dealer busted"]:
reason += "(dealer busted)"
winnings += 2 * data["blackjack games"][channel]["user hands"][user]["other hand"]["bet"]
elif calcHandValue(data["blackjack games"][channel]["user hands"][user]["other hand"]["hand"]) > dealerValue:
reason += "(highest value)"
winnings += 2 * data["blackjack games"][channel]["user hands"][user]["other hand"]["bet"]
elif calcHandValue(data["blackjack games"][channel]["user hands"][user]["other hand"]["hand"]) == dealerValue:
reason += "(pushed)"
winnings += data["blackjack games"][channel]["user hands"][user]["other hand"]["bet"]
else:
reason += "(highest value)"
else:
reason += "(busted)"
if winnings < 0: if winnings < 0:
if winnings == -1: if winnings == -1:
finalWinnings += user+" lost "+str(-1 * winnings)+" GwendoBuck "+reason+"\n" finalWinnings += user+" lost "+str(-1 * winnings)+" GwendoBuck "+reason+"\n"
@ -355,7 +518,7 @@ def blackjackFinish(channel):
else: else:
finalWinnings += user+" won "+str(winnings)+" GwendoBucks "+reason+"\n" finalWinnings += user+" won "+str(winnings)+" GwendoBucks "+reason+"\n"
netWinnings = winnings + data["blackjack games"][channel]["user hands"][user]["bet"] netWinnings = winnings + data["blackjack games"][channel]["user hands"][user]["bet"] + data["blackjack games"][channel]["user hands"][user]["other hand"]["bet"]
money.addMoney(user,netWinnings) money.addMoney(user,netWinnings)

View File

@ -26,9 +26,15 @@ def drawImage(channel):
for x in range(len(hands)): for x in range(len(hands)):
key, value = list(hands.items())[x] key, value = list(hands.items())[x]
userHand = drawHand(value["hand"],False,value["busted"],value["blackjack"]) userHand = drawHand(value["hand"],False,value["busted"],value["blackjack"])
textWidth = fnt.getsize(key)[0]
table.paste(userHand,(32+(384*placement[x]),680),userHand)
if value["split"]:
table.paste(userHand,(32+(384*placement[x]),560),userHand)
userOtherHand = drawHand(value["other hand"]["hand"],False,value["other hand"]["busted"],value["other hand"]["blackjack"])
table.paste(userOtherHand,(32+(384*placement[x]),700),userOtherHand)
else:
table.paste(userHand,(32+(384*placement[x]),680),userHand)
textWidth = fnt.getsize(key)[0]
textImage.text((32+(384*placement[x])+117-int(textWidth/2)-3,1010-3),key,fill=(0,0,0), font=fnt) textImage.text((32+(384*placement[x])+117-int(textWidth/2)-3,1010-3),key,fill=(0,0,0), font=fnt)
textImage.text((32+(384*placement[x])+117-int(textWidth/2)+3,1010-3),key,fill=(0,0,0), font=fnt) textImage.text((32+(384*placement[x])+117-int(textWidth/2)+3,1010-3),key,fill=(0,0,0), font=fnt)
textImage.text((32+(384*placement[x])+117-int(textWidth/2)-3,1010+3),key,fill=(0,0,0), font=fnt) textImage.text((32+(384*placement[x])+117-int(textWidth/2)-3,1010+3),key,fill=(0,0,0), font=fnt)
@ -57,28 +63,29 @@ def drawHand(hand, dealer, busted, blackjack):
background.paste(img,(x*125,0),img) background.paste(img,(x*125,0),img)
w, h = background.size w, h = background.size
textHeight = 290
if busted: if busted:
textWidth = fnt.getsize("BUSTED")[0] textWidth = fnt.getsize("BUSTED")[0]
textImage.text((int(w/2)-int(textWidth/2)-10,450-10),"BUSTED",fill=(0,0,0), font=fnt) textImage.text((int(w/2)-int(textWidth/2)-10,textHeight+20-10),"BUSTED",fill=(0,0,0), font=fnt)
textImage.text((int(w/2)-int(textWidth/2)+10,450-10),"BUSTED",fill=(0,0,0), font=fnt) textImage.text((int(w/2)-int(textWidth/2)+10,textHeight+20-10),"BUSTED",fill=(0,0,0), font=fnt)
textImage.text((int(w/2)-int(textWidth/2)-10,450+10),"BUSTED",fill=(0,0,0), font=fnt) textImage.text((int(w/2)-int(textWidth/2)-10,textHeight+20+10),"BUSTED",fill=(0,0,0), font=fnt)
textImage.text((int(w/2)-int(textWidth/2)+10,450+10),"BUSTED",fill=(0,0,0), font=fnt) textImage.text((int(w/2)-int(textWidth/2)+10,textHeight+20+10),"BUSTED",fill=(0,0,0), font=fnt)
textImage.text((int(w/2)-int(textWidth/2)-5,430-5),"BUSTED",fill=(255,255,255), font=fnt) textImage.text((int(w/2)-int(textWidth/2)-5,textHeight-5),"BUSTED",fill=(255,255,255), font=fnt)
textImage.text((int(w/2)-int(textWidth/2)+5,430-5),"BUSTED",fill=(255,255,255), font=fnt) textImage.text((int(w/2)-int(textWidth/2)+5,textHeight-5),"BUSTED",fill=(255,255,255), font=fnt)
textImage.text((int(w/2)-int(textWidth/2)-5,430+5),"BUSTED",fill=(255,255,225), font=fnt) textImage.text((int(w/2)-int(textWidth/2)-5,textHeight+5),"BUSTED",fill=(255,255,225), font=fnt)
textImage.text((int(w/2)-int(textWidth/2)+5,430+5),"BUSTED",fill=(255,255,255), font=fnt) textImage.text((int(w/2)-int(textWidth/2)+5,textHeight+5),"BUSTED",fill=(255,255,255), font=fnt)
textImage.text((int(w/2)-int(textWidth/2),430),"BUSTED",fill=(255,50,50), font=fnt) textImage.text((int(w/2)-int(textWidth/2),textHeight),"BUSTED",fill=(255,50,50), font=fnt)
elif blackjack: elif blackjack:
textWidth = fnt2.getsize("BLACKJACK")[0] textWidth = fnt2.getsize("BLACKJACK")[0]
textImage.text((int(w/2)-int(textWidth/2)-6,450-6),"BLACKJACK",fill=(0,0,0), font=fnt2) textImage.text((int(w/2)-int(textWidth/2)-6,textHeight+20-6),"BLACKJACK",fill=(0,0,0), font=fnt2)
textImage.text((int(w/2)-int(textWidth/2)+6,450-6),"BLACKJACK",fill=(0,0,0), font=fnt2) textImage.text((int(w/2)-int(textWidth/2)+6,textHeight+20-6),"BLACKJACK",fill=(0,0,0), font=fnt2)
textImage.text((int(w/2)-int(textWidth/2)-6,450+6),"BLACKJACK",fill=(0,0,0), font=fnt2) textImage.text((int(w/2)-int(textWidth/2)-6,textHeight+20+6),"BLACKJACK",fill=(0,0,0), font=fnt2)
textImage.text((int(w/2)-int(textWidth/2)+6,450+6),"BLACKJACK",fill=(0,0,0), font=fnt2) textImage.text((int(w/2)-int(textWidth/2)+6,textHeight+20+6),"BLACKJACK",fill=(0,0,0), font=fnt2)
textImage.text((int(w/2)-int(textWidth/2)-3,430-3),"BLACKJACK",fill=(255,255,255), font=fnt2) 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)+3,430-3),"BLACKJACK",fill=(255,255,255), font=fnt2) 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)-3,430+3),"BLACKJACK",fill=(255,255,255), font=fnt2) 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)+3,430+3),"BLACKJACK",fill=(255,255,255), font=fnt2) 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),430),"BLACKJACK",fill=(255,223,0), font=fnt2) textImage.text((int(w/2)-int(textWidth/2),textHeight),"BLACKJACK",fill=(155,123,0), font=fnt2)
return background.resize((int(w/3.5),int(h/3.5))) return background.resize((int(w/3.5),int(h/3.5)))