On the Subject of Gourmet Hamburger

Be thankful that this wasn’t Bottom Gear 4.

You are Seymour Skinner, former principal of Springfield Elementary School, and now the world’s greatest chef. Gary Chalmers has come to criticise your food, and you must make him a luncheon that he will never forget. Hamburgers should do the trick.

However, you accidentally put your world-famous burger recipe in the oven, and it has now been burned to ash. Oops. Your only option is to recreate it from scratch — fast food won’t cut it this time.

You’ve managed to narrow the choices for each layer down to three ingredients each, but you can’t remember how many layers the burger had. Thankfully, you still remember your creative process.

For each layer of the burger, find the results of its possible ingredients’ ADD conditions, in the table overleaf.

  • If one ingredient has a different result to the other two, add that ingredient.
  • Otherwise, if all three conditions have the same result, add the ingredient which appears first in the conditions table.

Each ingredient also has an END condition that needs to be looked at — if any possible ingredient’s END condition applies, then serve the burger immediately. The burger must also be served if the number of layers is twenty, and it cannot be served until the number of layers is five or more.

Adding an incorrect ingredient or serving the burger prematurely will cause a strike, and a time warp back to before the first layer has been added. The recipe will also change, because magic.

Note that red ingredients are meats (vertical stripes), green ingredients are vegetables (diagonal stripes) and blue ingredients are sauces (checkerboards). Other ingredients are untyped (this counts as a type).

If a condition asks about nonexistent layers, assume that those layers have untyped ingredients.

Ingredient ADD END
Patty If the previous layer is not meat, and the burger so far contains meat. If ADD applies, and at least three meats have been added so far.
Lettuce If the burger so far contains fewer vegetables than meats. If the number of layers so far is ten or more.
Cheese If the bomb’s serial number contains any letters from “SAO PAOLO”. If the burger so far contains exactly two Cheeses, or exactly three untyped ingredients.
Onions If neither of the previously-added ingredients were vegetables. If the previous two ingredients were both vegetables, and the two before them weren’t.
Chicken If the burger contains Lettuce or Mayonnaise, or the burger so far does not contain meat. If the burger contains Lettuce or Mayonnaise, and the burger so far contains two or more meats.
Tomatoes If the number of layers in the burger so far and the number of vegetables so far have differing parities. If ADD applies, and the burger has exactly five layers so far.
Ketchup If the burger so far does not contain any non-Ketchup sauces, and the burger so far does not contain Chicken. If ADD does not apply, and the burger so far contains exactly three sauces.
Bun If the burger so far is not empty, and the first ingredient in the burger so far is the same type as the last. If ADD applies, and the first and last ingredients are untyped.
Pickles If the burger so far contains two adjacent ingredients of the same type. If the burger so far contains three adjacent ingredients of the same type.
Ingredient ADD END
Salt If the burger so far has five or more layers, and doesn’t have any Salt. If ADD applies, and the burger so far contains Pepper.
Pepper If the burger so far has five or more layers, and doesn’t have any Pepper. If ADD applies, and the burger so far contains Salt.
Bacon If the burger so far contains Egg, or fewer meats than sauces. If the burger so far contains more meats than vegetables & sauces combined.
Barbecue Sauce If there are either one or three meats in the burger so far. If there are exactly four meats in the burger so far.
Burger Sauce If there are exactly two meats in the burger so far. If ADD applies, and at least one of those meats is a Patty.
Bell Peppers If the most frequent ingredient type in the burger so far is tied between two. If the most frequent ingredient type in the burger so far is tied between three.
Ham If the burger so far contains exactly one sauce. If the burger so far contains exactly two sauces, and one of them is the previous layer.
Mayonnaise If the burger so far contains at most one meat, and no sauce. If ADD would only apply if Mayonnaise wasn’t a sauce.
Egg If the last digit of the serial number is greater than the number of layers in the burger so far. If the sum of the digits in the serial number is less than the number of layers in the burger so far.
Mustard If the burger so far contains two or more sauces, and no Mustard. If ADD applies, and the burger so far contains Cheese, and Cheese’s ADD also applied.
Ingredient ADD END
Salami If the previous three ingredients in the burger so far are all not untyped. If ADD applies, and exactly one of those ingredients is a meat.
Basil If the burger so far contains exactly two distinct ingredient types. If the burger so far contains every ingredient type, except sauces.
Chili Powder If the burger so far contains no duplicate ingredients, and at most one vegetable. If the burger so far contains exactly two Chili Powders.
Asparagus If the burger so far has two or more layers, and the previous layer has a longer name than the layer before it. If ADD applies, and both names are shorter than this ingredient’s name.
Cod If the number of layers so far is less than three. If the number of layers so far is eight or more, and the serial number contains a vowel.
Curry Sauce If the burger so far contains Chili Powder or Cod, or the previous layer was a meat. If the previous layer is the only meat in the burger so far.
Worcestershire
Sauce
If the previous layer is not a vegetable, and the first layer is not meat. If ADD applies, and the first layer is a vegetable.
Salmon If the burger so far does not contain any sauce, and it contains at least one untyped ingredient. If the burger so far contains every ingredient type.
Green Beans Never applies. If the burger so far contains Green Beans.