SHOW:
|
|
- or go back to the newest paste.
| 1 | #mixing_bowls = list(list()) | |
| 2 | ||
| 3 | # loads the CHEF file and parses it into tokens | |
| 4 | # [<title>,<ingredient_string>,<instructions_string>] | |
| 5 | def readRecipe(filepath): | |
| 6 | pass | |
| 7 | ||
| 8 | # takes the instruction string from earlier and splits it into statements | |
| 9 | def preheat(instructions): | |
| 10 | pass | |
| 11 | - | # ['apple':96, etc.] |
| 11 | + | |
| 12 | # returns a dictionary of ingredients from a string | |
| 13 | # ['apple':('dry',96), 'oil':('wet', 59), etc.]
| |
| 14 | def gather(ingredients): | |
| 15 | pass | |
| 16 | - | # takes a string and returns a list of command-tuples |
| 16 | + | |
| 17 | - | # command: ('ingredient', <mixing_bowl_number>)
|
| 17 | + | |
| 18 | - | # looping: (' loop ', 'verb')
|
| 18 | + | # takes a list of strings and returns a list of command-tuples |
| 19 | - | # extern: (' run ', 'recipe')
|
| 19 | + | |
| 20 | # Following is a list of commands and descriptions, following the pattern | |
| 21 | # (<command>, <arguments>) - execute <command> with <arguments> | |
| 22 | # where the default value of ## is exactly 1 (signifying the mixing bowl index | |
| 23 | # and where # is a plain number | |
| 24 | # | |
| 25 | # For overloaded commands, use hasattr() for type checking | |
| 26 | # | |
| 27 | # ('take', 'ingredient') - get one character from the user and place its numeric value into ingredient
| |
| 28 | # ('put', 'ingredient', ##) - push the ingredient onto the ##th mixing bowl
| |
| 29 | # ('fold', 'ingredient', ##) - pop the ##th mixing bowl into the ingredient
| |
| 30 | # ('add', 'ingredient', ##) - peek at the ##th mixing bowl and add (numerically) ingredient to it
| |
| 31 | # ('remove', 'ingredient', ##) - peek at the ##th mixing bowl and subtract (numerically) ingredient from it
| |
| 32 | # ('combine', 'ingredient', ##) - peek at the ##th mixing bowl and multiply (numerically) ingredient with it
| |
| 33 | # ('divide', 'ingredient', ##) - peek at the ##th mixing bowl and divide (numerically) ingredient from it
| |
| 34 | # ('add', ##) - takes all of the dry ingredients and places the sum into the #th mixing bowl
| |
| 35 | # ('liquefy', 'ingredient') - transform the ingredient into its Unicode equivalent
| |
| 36 | # ('liquefy', ##) - transform the contents of the ##th mixing bowl into their Unicode equivalents
| |
| 37 | # ('stir', ##, #) -
| |
| 38 | # ('stir', 'ingredient', ##) -
| |
| 39 | # ('mix', ##) - randomize the order of the ##th mixing bowl
| |
| 40 | # ('clean', ##) - pop the ##th mixing bowl until empty
| |
| 41 | # ('loop', 'verb', 'ingredient') - See after.
| |
| 42 | - | pass |
| 42 | + | # ('next', 'verb', 'ingredient') - See after.
|
| 43 | # ('exit') - Continues execution after the next 'next'
| |
| 44 | # ('serve', 'recipe') - Invokes the execution of another recipe
| |
| 45 | # ('fridge') - Ends execution immediately and returns the first mixing bowl
| |
| 46 | # ('fridge, #) - Print out the first # baking dishes before calling ('fridge')
| |
| 47 | # | |
| 48 | # ('serves', #) - Pops and prints each baking dish in succession. This is the last command.
| |
| 49 | # | |
| 50 | # Looping: | |
| 51 | # 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'. | |
| 52 | # 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. | |
| 53 | ||
| 54 | # we may be able to make this fun by using list unpacking and functions | |
| 55 | def callMom(instructions): | |
| 56 | pass | |
| 57 | ||
| 58 | # executes a list of commands | |
| 59 | def cook(commands): | |
| 60 | # returns a list of verbs loaded from a file (path) | |
| 61 | # [("sift","sifted"),("boil","boiled"), ...]
| |
| 62 | def loadVerbs(path): | |
| 63 | pass | |
| 64 | ||
| 65 | # returns a list of foods loaded from a file (path) | |
| 66 | def loadFoods(path): | |
| 67 | pass | |
| 68 | ||
| 69 | ################################################### | |
| 70 | ||
| 71 | # iterate through the commands with complete control over position | |
| 72 | # (python's for-each loop does not give you any control) | |
| 73 | cmd_index = 0 | |
| 74 | while cmd_index < len(command): | |
| 75 | cmd_index += 1 | |
| 76 | pass | |
| 77 | ||
| 78 | pass | |
| 79 | ||
| 80 | print [None,[]] |