Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # H.A. Third-release
- from defs import *
- deckNumber=input('One or Six Deck(s)? One)1 Six)6 Default is one: ' )
- if deckNumber=="6":
- for i in range(int(deckNumber)):
- init1()
- init2()
- else:
- init1()
- init2()
- while True:
- random.shuffle(decks)
- #print(decks)
- selected()
- selectedPlayer()
- #print(decks)
- valueP =0
- valueD =0
- print ('Player Has: '+selectedPlayerCards[0]+' '+selectedPlayerCards[1])
- print ('Dealer has: '+selectedCards[0]+' ??')
- checkValueP1 = selectedPlayerCards[0].split(" ")[0]
- checkValueP2 = selectedPlayerCards[1].split(" ")[0]
- checkValueD1 = selectedCards[0].split(" ")[0]
- checkValueD2 = selectedCards[1].split(" ")[0]
- valueP =0
- valueD =0
- valueP=int(checkVal(checkValueP1))+int(checkVal(checkValueP2))
- if valueP==22:
- valueP=12
- valueD=int(checkVal(checkValueD1))+int(checkVal(checkValueD2))
- if valueD==22:
- valueD=12
- print('You have: ',valueP)
- if (valueP ==21):
- print ("Player Win, player has Blackjack")
- #exit()
- if (valueD ==21):
- print ("Dealer Win, Dealer has Blackjack")
- #exit()
- if valueD == 21 and valueP ==21:
- print("Tie, player and dealer has BlackJack")
- value=input('C(call), S(Stay)')
- x = 2
- if value=="C" or value=="c":
- while True:
- index = random.randint(0,len(decks)-1)
- selectedPlayerCards.append(str(decks[index]))
- decks.pop(index)
- if checkVal(selectedPlayerCards[x].split(" ")[0]) == 11 and valueP+11>21:
- valueP = valueP+1
- valueP = valueP+int(checkVal(selectedPlayerCards[x].split(" ")[0]))
- if valueP == 21:
- print('Player draws: '+ selectedPlayerCards[x] )
- print("Player has 21.")
- if len(selectedPlayerCards)<3:
- print("You have got a BlackJack")
- value="S"
- break
- if valueP >21:
- print('Player draws: '+ selectedPlayerCards[x] )
- print('Player has',valueP)
- print('Too much! The dealer wins')
- break
- print('Player draws: '+ selectedPlayerCards[x] )
- print('Player has',valueP)
- x = x+1
- value = input('C(call),S(Stay)')
- if value == "S" or value == "s":
- break
- z =2
- if value=="S" or value=="s":
- print ('Dealer has',selectedCards[0],selectedCards[1])
- print ('Dealer has:',valueD)
- while (valueD<17):
- index = random.randint(0,len(decks)-1)
- selectedCards.append(str(decks[index]))
- decks.pop(index)
- if checkVal(selectedCards[z].split(" ")[0]) == 11 and valueD+11>21:
- valueD = valueD+1
- valueD = valueD+int(checkVal(selectedCards[z].split(" ")[0]))
- print('Dealer draws:', selectedCards[z])
- z = z+1
- print ('Dealer has:',valueD)
- if valueD > valueP and valueD <=21:
- print('Dealer Wins')
- elif valueD == valueP:
- print('Tie')
- else:
- print('Player Wins')
- print ('Remaining cards: '+str(len(decks)))
- selectedCards.clear()
- selectedPlayerCards.clear()
- readExit=input('Press Q to Quit or any key to continue' )
- if readExit =="Q":
- break
Add Comment
Please, Sign In to add comment