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


Python Deck.cardNumberList方法代码示例

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


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

示例1: __init__

# 需要导入模块: from Deck import Deck [as 别名]
# 或者: from Deck.Deck import cardNumberList [as 别名]

#.........这里部分代码省略.........
					
					#~ print "-------------------",i
					#~ print "------jjjjj--------",j

					noaction = ""
					finalPlayerAction = noaction
					
					if (BlackJack.sumCards(self, playerCards[i]) >= 21):
							if verbose:
								print "You cannot ask for a card anymore" # TODO : better text here
							keepAsking = False
							
					else:
						
						questionText = ""
						
						if verbose:
							splitString = ""
							
							print BlackJack.displayPlayerCards(self, playerCards, i)
							
							if(self.splitIsValid(playerCards[i], playersSplit2[i])):
								splitString = "to split (P),"
							
							if(BlackJack.doubleIsValid(self, playerCards[i])):
								stringInput = ", do you want "+splitString+" to hit (H), to stay (S) or to double (D) ? "
							else:
								stringInput = ", do you want "+splitString+" to hit (H) or to stay (S) ? "
								
							questionText = self.players[i].getName() + stringInput

						#~ playerAction = raw_input(self.players[i].getName() + stringInput)
						playerAction = self.strategyList[i].getInput(questionText, "ACTION",
										self.deck.cardNumber(dealerCards[0]), self.deck.cardNumberList(playerCards[i]), BlackJack.sumCards(self, playerCards[i]),
										BlackJack.doubleIsValid(self, playerCards[i]), self.splitIsValid(playerCards[i], playersSplit2[i]))
						
						finalPlayerAction = playerAction
						
						if(playerAction == "H"):
							if (BlackJack.sumCards(self, playerCards[i]) >= 21):
								if verbose:
									print "You cannot ask for a card anymore" # TODO : better text here
								keepAsking = False
								finalPlayerAction = noaction
							else:
								playerCards[i].append(self.deck.drawCard())
								if verbose:
									print BlackJack.displayPlayerCards(self, playerCards, i)
						elif(playerAction == "D"):
							if(BlackJack.doubleIsValid(self, playerCards[i])):
								if verbose:
									print "Your bet has been doubled."
								bets[i] = 2*bets[i]
								playerCards[i].append(self.deck.drawCard())
								if verbose:
									print BlackJack.displayPlayerCards(self, playerCards, i)
									print "You've chose to Double, you cannot ask for a card anymore"
								keepAsking = False
							else:
								finalPlayerAction = noaction
								if verbose:
									print "You can't double in this situation."
						elif(playerAction == "S"):
							keepAsking = False
						elif(playerAction == "P"):
							if(self.splitIsValid(playerCards[i], playersSplit2[i])):
开发者ID:haroine,项目名称:BlackJack,代码行数:70,代码来源:BlackJack.py


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