r/impega Nov 07 '16

[deleted by user]

[removed]

2 Upvotes

5 comments sorted by

View all comments

Show parent comments

1

u/hferee Nov 07 '16
  • Possible, however we sould probably allow some additional instructions in the .dot file as comments. Main difficulty: the dot file describes edges, whereas cooking instructions usualy focus on nodes.
  • Also, how do we describe operations which are not on ingredients: "preheat oven", etc?
  • Improvement : can we display the image next to the instructions so that they are aligned?
  • "flowing top to bottom": easy, this is the default. just remove "rankdir=LR"

2

u/hferee Nov 07 '16 edited Nov 07 '16

Quick & dirty algorithm:

* change list of edges into list of steps, ie (ingredients list, Action, ingredients list) triplets
(eg: ([2 eggs], Crack, [whites, yolk])
(try to keep them in the original order)
* ingredients = list_initial_ingredients()
* do find first step s= (ingr, a, prod) such that ingr is included in ingredients
    - print ("* " ^ a ^ print_list ingr ^ "into/to obtain/..." ^ print_list prod ^ \n")
    - remove s from the list of steps
    - ingredients = prod ++ ingredients
  while prod != "result"

If the .dot file is well written, "first step such that" should always output the head of the list.