本文整理汇总了Python中Resource.Resource.coloredOutput方法的典型用法代码示例。如果您正苦于以下问题:Python Resource.coloredOutput方法的具体用法?Python Resource.coloredOutput怎么用?Python Resource.coloredOutput使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Resource.Resource
的用法示例。
在下文中一共展示了Resource.coloredOutput方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __str__
# 需要导入模块: from Resource import Resource [as 别名]
# 或者: from Resource.Resource import coloredOutput [as 别名]
def __str__(self):
symbolstr = ", ".join(["%s" % k for k in sorted(self.getSymbolCardLists().keys())])
secondCollection = ["%s" % k for k, l in sorted(self.getSymbolCardLists().items()) if len(l) > 1]
if secondCollection:
symbolstr += " || " + ", ".join(secondCollection)
multistrs = []
for symbol, cards in self.getMultiplierCardsBySymbol():
factor = sum([c.getMultiplier() for c in cards])
multistrs.append("%d x %s" % (factor, symbol.name))
return """%s%s%s
People: %d, Foodtrack: %d, Food: %d, Tools: %s, One-time tools: %s
Resources: %s
Hutcount: %d
Symbolcards: %s (%d)
Multipliercards: %s (%d)
score (cardscore): %d (%d)\n""" % (self.colorOS, self.color.name, self.colorOSnormal, \
self.getPersonCount(), self.getFoodTrack(), self.resources.count(Resource.food), self.toolbox, self.oneTimeTools,
Resource.coloredOutput(sorted(self.getNonFood())),
len(self.huts), \
symbolstr, self.symbolCardPoints(), \
", ".join(multistrs), self.multiplierCardPoints(),\
self.getScore(), self.getCardScore())
示例2: chooseResourecestoPay
# 需要导入模块: from Resource import Resource [as 别名]
# 或者: from Resource.Resource import coloredOutput [as 别名]
def chooseResourecestoPay(self, nonFoodResources, hut):
promptString = "\nchoose resources (format='wcsgj...') to pay the hut: %s\n available resources: %s " % (str(hut),
Resource.coloredOutput(nonFoodResources))
finished = False
while not finished:
chosenResources = fetchConvertedInput(promptString,
lambda v: printfString("the input '%s' does not consist of only numbers!", v),
mapToResources,
self.printPlayersFunc)
if not chosenResources:
chosenResources = nonFoodResources
finished = all([self.chosenItemsAvailable(nonFoodResources, chosenResources),
self.validPaymentIfAnyHut(hut, chosenResources),
self.validPaymentIfCountHut(hut, chosenResources)])
return chosenResources
示例3: filterOutPayableHuts
# 需要导入模块: from Resource import Resource [as 别名]
# 或者: from Resource.Resource import coloredOutput [as 别名]
def filterOutPayableHuts(self, player, huts):
notPayable, payable = [hut for hut in huts if not player.isPayable(hut)], [hut for hut in huts if player.isPayable(hut)]
if notPayable:
printError("with available resources: %s\nyou can't afford the following hut%s: " % (Resource.coloredOutput(player.getNonFood()) , suffix(notPayable)), " ".join([str(hut) for hut in notPayable]))
return payable
示例4: wantsToBuy
# 需要导入模块: from Resource import Resource [as 别名]
# 或者: from Resource.Resource import coloredOutput [as 别名]
def wantsToBuy(self, outstring, nonFoodResources, hutOrCard):
return fetchConvertedInput("with available resources: %s\ndo you want to buy this %s (y|n): %s ? (y) " % (Resource.coloredOutput(nonFoodResources),outstring, str(hutOrCard)),
lambda v: printfString("please answer y(es) or n(o) - not: '%s'", v),
yesNo,
self.printPlayersFunc)
示例5: doBuyCards
# 需要导入模块: from Resource import Resource [as 别名]
# 或者: from Resource.Resource import coloredOutput [as 别名]
def doBuyCards(self, player, cards, boughtCards, players, cardPile):
for card in cards:
if len(player.getNonFood()) < card[1]:
print("with available resources: %s you can't afford the following card:\nprice %d%s\n " % (Resource.coloredOutput(player.getNonFood()), card[1], str(card[0])))
elif self.wantsToBuy("card", player.getNonFood(), card[0]):
player.buyCard(card[0], players, cardPile, player.getNonFood()[:card[1]])
boughtCards.append(card[0])
return boughtCards
示例6: printResourceStatus
# 需要导入模块: from Resource import Resource [as 别名]
# 或者: from Resource.Resource import coloredOutput [as 别名]
def printResourceStatus(self, player):
nonFood = player.getNonFood()
print("available Resource%s: %s " % (suffix(nonFood), Resource.coloredOutput(nonFood)))
示例7: fetchPlacePersonsInput
# 需要导入模块: from Resource import Resource [as 别名]
# 或者: from Resource.Resource import coloredOutput [as 别名]
def fetchPlacePersonsInput(self, people, foodtrack, food, resources, personsLeft):
return fetchConvertedInput(self.prompt % (people, foodtrack, food, suffix(resources), Resource.coloredOutput(resources), personsLeft, suffix(personsLeft), suffix(personsLeft)),
lambda v: printfString("'%s' does not seem to be of format <Resource><number>!", v),
stringAndNumber,
self.printPlayersFunc)
示例8: removeResources
# 需要导入模块: from Resource import Resource [as 别名]
# 或者: from Resource.Resource import coloredOutput [as 别名]
def removeResources(self, resourcesToRemove):
for resource in resourcesToRemove:
if resource in self.resources:
self.resources.remove(resource)
else:
print("trying to remove resource: %s from resources: %s" % (resource.name, Resource.coloredOutput(self.resources)))
示例9: __str__
# 需要导入模块: from Resource import Resource [as 别名]
# 或者: from Resource.Resource import coloredOutput [as 别名]
def __str__(self):
suffix = self.isOccupied() and self.player.getOutputAbr() or ""
return Resource.coloredOutput(self._costs) + suffix