Currently in the Viking Code School Prep Work section, we are working on pseudo-coding. This block of code is an attempt at pseudo-coding a recipe for a grilled cheese sandwich. Pseudo-coding is actually proving to be really fun for me. I think one of the most difficult things about it has been coming up with my own formatting rules. I realized early on that I had to create my own mental model of how lines of code would work with one another, how they would escape the previous lines and other things like that.
Within the “program” I call
PROGRAM GroceryShopping which is another pseudo-coding practice assignment for the same Viking Code School assignment. While not necessary for the assignment, I thought it would be fun if they referenced one another. The original prompt can be found here: Practice with Pseudo-coding. That being said, working through the logic of these problems has been fun.
So, here is my Simple, At Least 28 Step, Depending on Circumstances, Grilled Cheese Sandwich Recipe:
PROGRAM GrilledCheeseSandwich get items out of the refrigerator for sandwich check items for mold IF item has mold THEN discard item ELSE place on counter check all ingredients are present IF ingredients are missing THEN DO PROGRAM GroceryShopping ELSE continue to next step cut cheese into thin slices and place on slice of bread WHILE there is still free space on bread cut more cheese get frying pan IF pan is dirty THEN clean pan ELSE place pan on burner turn heat on medium high allow pan to heat start timer IF timer &amp;amp;amp;amp;lt; 1 minute THEN wait ELSE continue to next step open butter cut thin slab of butter off place butter in pan swirl butter in pan IF butter is melted THEN swirl butter in pan IF butter does not cover bottom of pan THEN add more ELSE continue ELSE continue place slice of bread in pan arrange cheese slices on bread to fill space place slice of bread on top of start timer IF timer &amp;amp;amp;amp;lt; 3 minutes THEN wait ELSE check bottom to see if it is golden brown WHILE the bottom is not golden brown DO check bottom wait 20 seconds flip sandwich start timer IF timer &amp;amp;amp;amp;lt; 2 minutes THEN wait ELSE check cheese to see if it is melted WHILE cheese is not melted DO check cheese wait 20 seconds place sandwich on plate place dirty pan and utensils in sink enjoy END