Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import random
- class Deck: #!
- def __init__(self,numsuit,numcard):
- self.numsuit = numsuit
- self.numcard = numcard
- self.deck = [[True] * numsuit for i in range (numcard)]
- def createCard(self): #!
- if self.deck.count:
- suitval = random.randint(0,self.numsuit-1)
- cardval = random.randint(0,self.numcard-1)
- while self.deck[cardval][suitval] == False:
- suitval = random.randint(0,self.numsuit-1)
- cardval = random.randint(0,self.numcard-1)
- self.deck[cardval][suitval] = False
- return((cardval,suitval))
- def createHand(self,handSize):
- cards = []
- for i in range(handSize):
- card = deck.createCard(self)
- cards.append(card)
- return(cards)
- def changeHand(self,hand,indexList):
- for i in range(len(indexList)):
- hand[indexList[i]] = deck.createCard(self)
- return(hand)
- class Player:
- def __init__(self,startBalance,name):
- self.balance = startBalance
- self.name = name
- def bet(self,betamount):
- pass
- class Poker:
- def __init__(self,):
- theDeck = Deck(4,13)
- theHand = theDeck.createHand(5)
- print(theHand)
- theHand = theDeck.changeHand(theHand,[0,1])
- print(theHand)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement