当前位置: 首页>>代码示例>>Python>>正文


Python Table.fold方法代码示例

本文整理汇总了Python中Table.Table.fold方法的典型用法代码示例。如果您正苦于以下问题:Python Table.fold方法的具体用法?Python Table.fold怎么用?Python Table.fold使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Table.Table的用法示例。


在下文中一共展示了Table.fold方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: Linker

# 需要导入模块: from Table import Table [as 别名]
# 或者: from Table.Table import fold [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))
开发者ID:JoeStaines,项目名称:Biopoker,代码行数:46,代码来源:Linker.py

示例2: int

# 需要导入模块: from Table import Table [as 别名]
# 或者: from Table.Table import fold [as 别名]
	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"
		
		c = int(raw_input())
		if c == 1:
			table.call(table.playerList[table.turn])
		elif c == 2:
			r = int(raw_input("Raise: "))
			table.raiseBet(table.playerList[table.turn], r)
		elif c == 3:
			table.fold(table.playerList[table.turn])
		elif c == 0:
			break
		
		
开发者ID:JoeStaines,项目名称:Biopoker,代码行数:31,代码来源:mainGame.py


注:本文中的Table.Table.fold方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。