本文整理汇总了Python中Deck.Deck.cardNamesList方法的典型用法代码示例。如果您正苦于以下问题:Python Deck.cardNamesList方法的具体用法?Python Deck.cardNamesList怎么用?Python Deck.cardNamesList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Deck.Deck
的用法示例。
在下文中一共展示了Deck.cardNamesList方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from Deck import Deck [as 别名]
# 或者: from Deck.Deck import cardNamesList [as 别名]
#.........这里部分代码省略.........
playerActionList.extend(finalPlayerAction)
if len(playerActionList) < 1:
playerActionList = [noaction]
playersActions.append(playerActionList)
i = i+1
j = j+1
if (i >= len(self.players)):
cont = False
### Make dealer draw or stay
keepDrawing = True
while (keepDrawing):
if verbose:
print BlackJack.displayDealerCards(self, dealerCards, True) # Show Dealer cards
## Dealer stands on soft 17
if(BlackJack.sumCards(self, dealerCards) <= 16):
if verbose:
print "Dealer draws"
dealerCards.append(self.deck.drawCard())
else:
if verbose:
print "Dealer stands"
keepDrawing = False
### Display win or lose and addMoney
BlackJack.results(self, dealerCards, playerCards, bets, insurancesList)
self.logDF['dealerCards'][self.currentRoundNumber] = str(dealerCards).strip('[]')
self.logDF['dealerCardsNames'][self.currentRoundNumber] = str(self.deck.cardNamesList(dealerCards)).strip('[]')
dealerScore = BlackJack.sumCards(self, dealerCards)
dealerBlackJack = BlackJack.hasBlackJack(self, dealerCards)
if dealerBlackJack:
dealerScore = "BJ"
self.logDF['dealerScore'][self.currentRoundNumber] = dealerScore
## Compute correct amount of money for players who splitted
k = 0 ## k = index with splitted hands
for i in range(len(playersBackup)): ## i = index of true number of players
cardsPlayer = playerCards[i]
scorePlayer = [BlackJack.sumCards(self, playerCards[i])]
playerBlackJack = BlackJack.hasBlackJack(self, playerCards[i])
if playerBlackJack:
scorePlayer = ["BJ"]
## When players are given cards that don't call for action
## (e.g. Black Jack), actionsPlayer can be non existent
try:
actionsPlayer = playersActions[i]
except:
actionsPlayer = ""
if playersSplit[i]:
moneyWithSplitResult = self.players[k].money + self.players[k+1].money - playersBackup[i].money
#~ print "with split result : ", moneyWithSplitResult
playersBackup[i].money = moneyWithSplitResult
k = k+1
cardsPlayer.extend(playerCards[k])
actionsPlayer.extend(playersActions[k])
scorePlayer.extend([BlackJack.sumCards(self, playerCards[k])]) ## BJ are not valid on splits
else:
playersBackup[i].money = self.players[k].money