Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Player:
- def __init__(self,startBalance,name,game):
- self.balance = startBalance
- self.name = name
- self.game = game
- def bet(self,betAmount):
- if betAmount <= self.balance:
- self.balance -= betamount
- self.game.currentPot += betamount
- class Poker:
- def __init__(self):
- self.checked = False
- self.turn = 0
- self.currentPot = 0
- def addPlayers(self,playerList):
- self.playerList = playerList
- def check(self):
- self.checked = True
- self.turn += 1
- def fold(self,player):
- Poker.newRound(self,self.playerList[(self.turn + 1) % 2])
- def checkWinner(self):
- pass
- def newRound(self,winner):
- winner.balance += self.currentPot
- print("The winner is "+ winner.name)
- self.currentPot = 0
- self.turn = 0
- Game = Poker()
- Sina = Player(1000,"Sina",Game)
- Varun = Player(1000,"Varun",Game)
- Game.addPlayers([Sina,Varun])
- Game.fold(Sina)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement