Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import random
- from collections import namedtuple
- Deck = namedtuple('Deck','DeckAndType')
- highcards = "JQKA"
- decks = list()
- selectedCards = list()
- selectedPlayerCards = list()
- def init1():
- for j in range(0,4,1):
- for i in range (2,11,1):
- if j ==0:
- temp = Deck(str(i)+" h")
- elif j==1:
- temp = Deck(str(i)+" c")
- elif j==2:
- temp= Deck(str(i)+" d")
- else:
- temp = Deck(str(i)+" s")
- decks.append(temp.DeckAndType)
- pass
- def init2():
- for z in highcards:
- temp= Deck(z+" h")
- decks.append(temp.DeckAndType)
- temp = Deck(z+" c")
- decks.append(temp.DeckAndType)
- temp = Deck(z+" d")
- decks.append(temp.DeckAndType)
- temp= Deck(z+" s")
- decks.append(temp.DeckAndType)
- def selected():
- if len(decks)>2:
- index = random.randint(0,len(decks)-1)
- selectedCards.append(str(decks[index]))
- decks.pop(index)
- index = random.randint(0,len(decks)-1)
- selectedCards.append(str(decks[index]))
- decks.pop(index)
- else:
- exit()
- def selectedPlayer():
- if len(decks)>2:
- index = random.randint(0,len(decks)-1)
- selectedPlayerCards.append(str(decks[index]))
- decks.pop(index)
- index = random.randint(0,len(decks)-1)
- selectedPlayerCards.append(str(decks[index]))
- decks.pop(index)
- else:
- exit()
- def checkVal(check):
- if check == 'A':
- valueP=11
- elif check == 'K' or check =='Q' or check == 'J':
- valueP=10
- else:
- valueP = check
- return valueP
Advertisement
Comments
-
- what is this
-
- https://pastebin.com/pRdnVRq3
- Check this, maybe you will get it
Add Comment
Please, Sign In to add comment
Advertisement