1
\$\begingroup\$

The hamburger joint maHburger has hired you to write a program for them.

It is simple: make an ASCII hamburger, using the key. Sounds simple right? Well these customers are super picky, but one thing is for sure, they do love onions.

Write a program that accepts the customer's orders, and prints a hamburger with as many onions as possible.

Key

O=Onions
P=Pickles
M=Mustard
K=Ketchup
#=Bread
.=Sesame Seed
&=Meat
_=Nothing

Input

Through stdin, or closest alternative, your program will receive the customer's order.

Arguments: (number of patties) (Condiments preference) (number of pickles) (number of sesame seeds)

Condiments preference:

  • M: more mustard (above 50% below 80%)
  • K: more ketchup (above 50% below 80%)
  • NM: nu mustard
  • NK: no ketchup
  • NMK: no condiments
  • E: Ketchup and Mustard (between 40% and 60% each)

Rules

  • Pickles:
    • Size: 7-21
    • There must be a pickle that is at least 14 characters, if one or more pickles were ordered.
  • Mustard:
    • Size: 2-7
    • No mustard may be touching Ketchup.
  • Ketchup:
    • Size: 2-7
    • No ketchup may be touching Mustard.
  • Onions:
    • If a onion is touching two M's, K's or P's It is considered an M, K, or P as well.
    • An onion may not be touching an M and an K at the same time.
    • An onion may not be at the edge of the hamburger.
    • Only up to 2 onions in and 5 character space.
  • Sesame seeds are on the top bun only, and may not be touching each other.
  • Nothing: only up to 10 per patty.
  • Patties: Customers always order at least 2.

Example:

2 E 3 16

Means 2 patties, Normal condiments, 3 pickles, 16 sesame seeds

and could produce:

                  ###.##########
              ###.#############.####
          ##########.###################
       ###.######.######.######.######.####
     #######.#############.##################
   ###########################.################
  #################.#################.##########
 ###############.#############.##################
##################################################
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
_KKKKKK__MMMMMMMOPPPOPOP_O_PPPPPPOPPPPOPPPPPPPPPOP
##################################################
##################################################
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
KKKKKK_OMMMMMOMO_KOKPPOPPPPPO_MMMMMMMO_OKKKK__OO__
##################################################
##################################################
##################################################

Code Golf

This is code golf, so the shortest code wins. There are bonuses for the amount of onions your code produces, for the following test cases:

"2 E 3 16"      -5 bytes per onion
"8 M 25 17"     -1 byte per 5 onions
"2 NMK 5 13"    -8 bytes per onion
"2 NK 100 500" -20 bytes if your program prints "No maHburger for you!" for impossible hamburgers.

The bonuses may change.

Format

# Language name, x bytes
How many onions your program produced, and the hamburgers the program created.
code
explanation (if needed)

ASCII

Any whitespace that doesn't affect the ASCII art is fine.

                  ##############
              ######################
          ##############################
       ####################################
     ########################################
   ############################################
  ##############################################
 ################################################
##################################################

Is the top bun

&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&

Line of Condiments (50 char long)

##################################################
##################################################

for every patty

Standard Loopholes apply.

This is my first Code Golf Challenge! Yay!

This challenge was inspired by this.

\$\endgroup\$
5
  • 7
    \$\begingroup\$ No mustard may be touching Mustard.... \$\endgroup\$
    – user42643
    Sep 15 '15 at 1:07
  • \$\begingroup\$ Oops, forgot to change that to ketchup when I copied and pasted that. \$\endgroup\$ Sep 15 '15 at 1:20
  • \$\begingroup\$ @minxomat Fixed. \$\endgroup\$ Sep 15 '15 at 1:23
  • \$\begingroup\$ "There must be a pickle that is at least 14 characters, if one or more pickles were ordered." - however, I can't see such long sequence of P letters in the sample hamburger? \$\endgroup\$ Sep 15 '15 at 8:15
  • \$\begingroup\$ The onion counts as a P when it is surrounded by P's (onion rule 1) \$\endgroup\$ Sep 15 '15 at 10:16

Browse other questions tagged or ask your own question.