本文整理汇总了Python中Table.Table.beginRound方法的典型用法代码示例。如果您正苦于以下问题:Python Table.beginRound方法的具体用法?Python Table.beginRound怎么用?Python Table.beginRound使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Table.Table
的用法示例。
在下文中一共展示了Table.beginRound方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Linker
# 需要导入模块: from Table import Table [as 别名]
# 或者: from Table.Table import beginRound [as 别名]
class Linker():
def __init__(self):
self.stateDict = {}
print "starting Table init"
self.tableObj = Table()
p1 = Player("p1", 1000)
p2 = Player("p2", 1000)
p3 = Player("p3", 1000)
self.tableObj.addPlayer(p1)
self.tableObj.addPlayer(p2)
self.tableObj.addPlayer(p3)
self.tableObj.beginRound()
print "starting UI"
self.UIObj = UI(self)
self.UIObj.loop()
def linkCall(self):
self.tableObj.call(self.tableObj.playerList[self.tableObj.turn])
def linkRaise(self, amount):
self.tableObj.raiseBet(self.tableObj.playerList[self.tableObj.turn], amount)
def linkFold(self):
self.tableObj.fold(self.tableObj.playerList[self.tableObj.turn])
def checkForUpdate(self):
if self.tableObj.stateDict != {}:
statePickle = cPickle.dumps(self.tableObj.stateDict)
self.tableObj.stateDict = {}
return statePickle
else:
return None
def printTableState(self):
gameStateMapping = ["PREFLOP","FLOP","TURN","RIVER"]
print "Player List: {0}".format(self.tableObj.playerList)
print "Betting Round: {0}".format(gameStateMapping[self.tableObj.gameState])
print "Pots: {0}\tCurrent Bet: {1}".format(self.tableObj.pots, self.tableObj.currentBet)
print "Player: {0}\tHand: {1}".format( self.tableObj.playerList[self.tableObj.turn].name, \
Cards.convertNumToCards(self.tableObj.playerList[self.tableObj.turn].hand) )
print "Money: {0}\tBet Amount: {1}".format(self.tableObj.playerList[self.tableObj.turn].money, self.tableObj.playerList[self.tableObj.turn].betAmount)
print "Community: {0}".format(Cards.convertNumToCards(self.tableObj.communityCards))
示例2: Table
# 需要导入模块: from Table import Table [as 别名]
# 或者: from Table.Table import beginRound [as 别名]
from Table import Table
from Player import Player
import Cards
if __name__ == "__main__":
table = Table()
p1 = Player("p1", 1000)
p2 = Player("p2", 1000)
p3 = Player("p3", 1000)
p4 = Player("p4", 1000)
table.addPlayer(p1)
table.addPlayer(p2)
table.addPlayer(p3)
table.addPlayer(p4)
table.beginRound()
gameStateMapping = ["PREFLOP","FLOP","TURN","RIVER"]
gameRunning = True
while gameRunning:
print "Betting Round: {0}".format(gameStateMapping[table.gameState])
print "Pots: {0}\tCurrent Bet: {1}".format(table.pots, table.currentBet)
print "Player: {0}\tHand: {1}".format( table.playerList[table.turn].name, \
Cards.convertNumToCards(table.playerList[table.turn].hand) )
print "Money: {0}\tBet Amount: {1}".format(table.playerList[table.turn].money, table.playerList[table.turn].betAmount)
print "Community: {0}".format(Cards.convertNumToCards(table.communityCards))
print "\n1. Call"
print "2. Raise"
print "3. Fold"
print "0. Exit"