Advertisement
dmesticg

Untitled

Jun 13th, 2018
144
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.02 KB | None | 0 0
  1. class Player:
  2. def __init__(self,startBalance,name,game):
  3. self.balance = startBalance
  4. self.name = name
  5. self.game = game
  6.  
  7. def bet(self,betAmount):
  8. if betAmount <= self.balance:
  9. self.balance -= betamount
  10. self.game.currentPot += betamount
  11.  
  12.  
  13.  
  14. class Poker:
  15. def __init__(self):
  16. self.checked = False
  17. self.turn = 0
  18. self.currentPot = 0
  19. def addPlayers(self,playerList):
  20. self.playerList = playerList
  21. def check(self):
  22. self.checked = True
  23. self.turn += 1
  24. def fold(self,player):
  25. Poker.newRound(self,self.playerList[(self.turn + 1) % 2])
  26. def checkWinner(self):
  27. pass
  28. def newRound(self,winner):
  29. winner.balance += self.currentPot
  30. print("The winner is "+ winner.name)
  31. self.currentPot = 0
  32. self.turn = 0
  33.  
  34.  
  35.  
  36.  
  37. Game = Poker()
  38. Sina = Player(1000,"Sina",Game)
  39. Varun = Player(1000,"Varun",Game)
  40. Game.addPlayers([Sina,Varun])
  41.  
  42. Game.fold(Sina)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement