| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109 |
- '''
- Created on 17 mars 2019
- @author: olinox
- '''
- class Base(): pass
- class Location(Base):
- name = ""
- passable = False
- class SpecialLocation(Location):
- pass
- class DishWasher(SpecialLocation):
- pass
- class IcecreamCrate(SpecialLocation):
- pass
- class BlueberriesCrate(SpecialLocation):
- pass
- class StrawberriesCrate(SpecialLocation):
- pass
- class DoughCrate(SpecialLocation):
- pass
- class ChoppingBoard(SpecialLocation):
- pass
- class Recipe(Base):
- location = None
- cooking_time = 0
- requirements = []
- needs_free_hands = False
-
- def available(self):
- return []
-
- def get(self):
-
- pass
-
- # if available:
- # # get it
- # else:
- # # does it have requirements?
- # # if it has requirements that we don't hold:
- # # recurse on those.
- #
- # # if it has requirements that we hold:
- # # does it have a cooking time?
- #
- # # if yes: cook it
- # # if no: go to self.location
-
-
- class FinalProduct(Recipe):
- needs_dish = True
-
- class Ingredient(Recipe):
- needs_free_hands = True
- class Dish(Recipe):
- location = DishWasher
- class IceCream(FinalProduct):
- location = IcecreamCrate
- class Blueberries(FinalProduct):
- location = BlueberriesCrate
-
- class Strawberries(Ingredient):
- location = StrawberriesCrate
- needs_free_hands = True
-
- class ChoppedStrawberries(FinalProduct):
- location = ChoppingBoard
- requirements = [Strawberries]
-
- class Dough(Ingredient):
- location = DoughCrate
- needs_free_hands = True
- class Croissant(FinalProduct):
- requirements = [Dough]
- cooking_time = 10
-
- class ChoppedDough(Ingredient):
- requirements = [Dough]
- location = ChoppingBoard
-
- class RawTart(Ingredient):
- ingredients = [ChoppedDough, Blueberries]
-
- class Tart(FinalProduct):
- ingredients = [RawTart]
- cooking_time = 10
- class ExampleOrder():
- elements = [Dish, IceCream, ChoppedStrawberries, Croissant]
-
- def available(self):
- # special
- return []
-
-
|