Because it's Saturday (UTC) and I'm hungry, I would like a slice of pizza. I will give you an order and I would like a nice hot ascii-art pizza. Up to the challenge?
I'll place my order wherever your drive-thru is, whether it is STDIN, a function parameter, a command-line argument, but I'm not going to put it in a variable for you. (JS function expressions must be assigned to a variable.)
My order will have 2 parts. The first will be a positive, non-zero integer from
6. This is the size of my pizza. For instance, a size
6 pizza with no toppings would look like:
/=====\ / \ | | | | \ / \=====/
/====\ / \ | | \ / \====/
/===\ | | | | \===/
/==\ | | \==/
My toppings will be a string of UPPERCASE letters. Here are the possible values:
P - Pepperoni S - Sausage N - piNeapple J - Jalapenos B - Banana peppers C - baCon
You must fit them on the pizza somewhere. If I order a size 4 and
PSPCJ, then this is a valid output:
/===\ |PSPCJ| | | \===/
So is this:
/===\ |P P J| | S C | \===/
/===\ | | |PSPCJ| \===/
I am not really picky about where my toppings are on the pizza, as long as they aren't on the crust or on top of each other.
The pick-up window
I will go to a lot of places to pick up my pizza, including STDOUT, a file, the return value of a function, but not a variable.
- Standard loopholes forbidden
- This is tagged code-golf so the shortest answer in bytes wins!
- Don't worry about invalid input (toppings > pizza space, etc.)
- See my answer (JS ES6) below for an example (I hope you can do better)