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 Game:
- def __init__(self,configFile):
- self.variableNames = {"test":0,"yeet":0}
- try:
- with open(configFile,"r") as file:
- for line in file:
- line = line.replace(" ","")
- name,value = line.split("")
- self.variableNames[name] = value.strip()
- except Exception as E:
- print(E)
- def drawBoxes(self,boxList):
- textSize(30)
- fill(255)
- for i in range(len(boxList)):
- fill(boxList[i][5])
- rect(boxList[i][0],boxList[i][1],boxList[i][2],boxList[i][3])
- fill(255)
- text(boxList[i][4],boxList[i][0],boxList[i][1]+35)
- def board(self):
- pass
- #background(variableNames["backgroundColor"])
- #image(variableNames["pokertable",0,0,1000,650]
- theDeck = Deck(4,13)
- theHand = theDeck.createHand(5)
- print(theHand)
- theHand = theDeck.changeHand(theHand,[0,1])
- print(theHand)
- ##
- ##game = Board("configFile.txt")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement