Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def readRecipe(filepath):
- """Loads the given *.chef file and does initial parsing.
- This method will parse the given filename
- See http://docs.python.org/library/doctest.html#module-doctest
- So much awesome.
- >>> print hw.chef
- ["Hello World Souffle", "...", "...", "..."]
- """
- pass
- # takes the instruction string from earlier and splits it into statements
- def preheat(method):
- """Takes all of the statements (as a single string) under Method and begins the parsing process.
- This method returns a list of simple tuples where the first element is the command
- and the second element is the source string. The output of this method is intended
- for calling Mom.
- """
- pass
- def gather(ingredients):
- """Return a dictionary of ingredients from the given string.
- The dictionary returned will contain the ingredient as a string
- mapped to a tuple, where the first element indicates if it is dry or wet
- and the second element denotes its numeric value.
- Example:
- {'apple':('dry', 96), 'oil':('wet', 59), etc.}
- """
- pass
- # Because we all know her handwriting is horrid.
- # we may be able to make this fun by using advanced features of functions in Python
- def callMom(method):
- """Takes a list of command-string tuples and returns a list of pure command-tuples.
- Following is a list of commands and descriptions, following the pattern
- (<command>, <arguments>) - execute <command> with <arguments>
- where the default value of ## is exactly 1 (signifying the mixing bowl index
- and where # is a plain number
- For overloaded commands, use hasattr() for type checking
- ('take', 'ingredient') - get one character from the user and place its numeric value into ingredient
- ('put', 'ingredient', ##) - push the ingredient onto the ##th mixing bowl
- ('fold', 'ingredient', ##) - pop the ##th mixing bowl into the ingredient
- ('add', 'ingredient', ##) - peek at the ##th mixing bowl and add (numerically) ingredient to it
- ('remove', 'ingredient', ##) - peek at the ##th mixing bowl and subtract (numerically) ingredient from it
- ('combine', 'ingredient', ##) - peek at the ##th mixing bowl and multiply (numerically) ingredient with it
- ('divide', 'ingredient', ##) - peek at the ##th mixing bowl and divide (numerically) ingredient from it
- ('add', ##) - takes all of the dry ingredients and places the sum into the #th mixing bowl
- ('liquefy', 'ingredient') - transform the ingredient into its Unicode equivalent
- ('liquefy', ##) - transform the contents of the ##th mixing bowl into their Unicode equivalents
- ('stir', ##, #) -
- ('stir', 'ingredient', ##) -
- ('mix', ##) - randomize the order of the ##th mixing bowl
- ('clean', ##) - pop the ##th mixing bowl until empty
- ('loop', 'verb', 'ingredient') - See after.
- ('next', 'verb', 'ingredient') - See after.
- ('exit') - Continues execution after the next 'next'
- ('serve', 'recipe') - Invokes the execution of another recipe
- ('fridge') - Ends execution immediately and returns the first mixing bowl
- ('fridge, #) - Print out the first # baking dishes before calling ('fridge')
- ('serves', #) - Pops and prints each baking dish in succession. This is the last command.
- Note that everything that follows the 'serve' command is an auxiliary recipe.
- Looping:
- With the 'loop' command, if the ingredient is non-zero, continue execution until reaching the 'next' command. If the ingredient is zero, continue execution after a matching 'next'.
- At the 'next' command, if an ingredient is given (defaulting to the ingredient given by 'loop'), continue execution at the previous 'loop' if the given ingredient is non-zero. If the ingredient is zero, simply continue.
- The output of this method is intended for cooking.
- """
- pass
- def loadVerbs(path):
- """Return a list verbs and their past-tense form read from a file with the given path.
- The return will be a list of tuples containing two strings:
- the first being the infinite stem, the second being the simple past.
- Example:
- [("sift","sifted"),("boil","boiled"), ...]
- """
- pass
- def loadFoods(path):
- """ Returns a simple list of foods read from a file with the given path.
- """
- pass
- # executes a list of commands
- def cook(ingredients, method):
- """Execute the list of commands given using the ingredients provided.
- Execute the given list of commands in the format given by calling Mom.
- It is an error if a given command does not exist.
- """
- ###################################################
- # iterate through the commands with complete control over position
- # (python's for-each loop does not give you any control)
- cmd_index = 0
- while cmd_index < len(method):
- cmd_index += 1
- pass
- pass
- print callMom.__doc__
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement