def default_replace(line, recipe, concrete_tools, replacement_tuples):
        line = replace_choosing_sections(line)

        line = line.replace("{materials}", tools.concat_list(recipe.available_materials, lambda material: "m{{" + material.get_label_full() + "}}m")) \
                   .replace("{product}", "e{{" + recipe.end_product + "}}e") \
                   .replace("{aproduct}", recipe.end_product_indefinite_article + "e{{" + recipe.end_product + "}}e")

        index = 1
        for tool in concrete_tools:
            line = line.replace("{tool" + str(index) + "}", tool)
            index += 1

        for replacement_tuple in replacement_tuples:
            line = line.replace(replacement_tuple[0], replacement_tuple[1])

        return line
    def execute_internal(self, tool, recipe):
        if not recipe.has_materials_available():
            return False

        thrown_away_materials = []
        while recipe.has_materials_available():
            material = recipe.take_random_material()

            if not self.destroying:
                tool.filling_materials.append(material)

            thrown_away_materials.append(material)

        result = tool.default_replace(self.instruction) \
                     .replace("{materials}", tools.concat_list(thrown_away_materials, lambda m: "m{{" + m.get_label_full() + "}}m"))

        recipe.add_instruction(result)

        return True
 def default_replace(self, string):
     return string.replace("{tool}", "t{{" + self.name + "}}t") \
                  .replace("{contents}", tools.concat_list(self.filling_materials, lambda material: material.get_label_short()))
 def get_adjectives_label(self):
     return tools.concat_list(self.adjectives)