original_docstring: |amount| is the amount of money the player has, |goods| is a map from
         goods to the amount of goods of that type the player has. Returns None if
         the amount and goods cannot pay for the building, otherwise return a map
         from resources to the amount that must be paid on each resource. If
         |amount| is None, assumes the player has enough resources.
docstring: |amount| is the amount of money the player has, |goods| is a map from
  goods to the amount of goods of that type the player has. Returns None if
  the amount and goods cannot pay for the building, otherwise return a map
  from resources to the amount that must be paid on each resource. If
  |amount| is None, assumes the player has enough resources.
docstring_tokens: |amount| is the amount of money the player has |goods| is a map from goods to the amount of goods of that type the player has . Returns None if the amount and goods cannot pay for the building otherwise return a map from resources to the amount that must be paid on each resource . If |amount| is None assumes the player has enough resources .
code: def calculatePayment(self, amount = None, goods = None):
      """|amount| is the amount of money the player has, |goods| is a map from
         goods to the amount of goods of that type the player has. Returns None if
         the amount and goods cannot pay for the building, otherwise return a map
         from resources to the amount that must be paid on each resource. If
         |amount| is None, assumes the player has enough resources."""
      value = self.buildingValue()
      if value == 0 or self.buildingSize() == 0:
        return None
      if amount is None:
        amount = value * self.buildingSize()
        available = {good: 0 for good in Goods}
      else :
        available = goods.copy()
      payments = {resource: 0 for resource in AllResources}
      for card in self.cardColumn:
        neededFromAmount = value
        if resources.isGoods(card.resource):
          used = min(value, available[card.resource])
          available[card.resource] -= used
          neededFromAmount -= used
        if amount < neededFromAmount:
          return None
        amount -= neededFromAmount
        payments[card.resource] += value
      return payments
code_tokens: def calculatePayment ( self , amount = None , goods = None ) : value = self . buildingValue ( ) if value == 0 or self . buildingSize ( ) == 0 : return None if amount is None : amount = value * self . buildingSize ( ) available = { good : 0 for good in Goods } else : available = goods . copy ( ) payments = { resource : 0 for resource in AllResources } for card in self . cardColumn : neededFromAmount = value if resources . isGoods ( card . resource ) : used = min ( value , available [ card . resource ] ) available [ card . resource ] -= used neededFromAmount -= used if amount < neededFromAmount : return None amount -= neededFromAmount payments [ card . resource ] += value return payments
short_docstring: |amount| is the amount of money the player has, |goods| is a map from
  goods to the amount of goods of that type the player has.
short_docstring_tokens: |amount| is the amount of money the player has |goods| is a map from goods to the amount of goods of that type the player has .
comment: """|amount| is the amount of money the player has, |goods| is a map from
         goods to the amount of goods of that type the player has. Returns None if
         the amount and goods cannot pay for the building, otherwise return a map
         from resources to the amount that must be paid on each resource. If
         |amount| is None, assumes the player has enough resources."""