Here is a simple ASCII art snowman:
_===_ (.,.) ( : ) ( : )
Let's make him some friends. This will be the general pattern for our ASCII art snowpeople:
HHHHH HHHHH X(LNR)Y X(TTT)Y (BBB)
The leading spaces and the parentheses are always the same for all snowpeople. The different letters represent sections of the pattern that can individually change. Each section has exactly four presets for what ASCII characters can fill it. By mixing and matching these presets for all eight sections, we can make a variety of snowpeople.
(Notice that spaces are put on otherwise empty lines so the section shape is always correct.)
H is for Hat
N is for Nose/Mouth
L is for Left Eye
R is for Right Eye
(Same list as left eye.)
X is for Left Arm
Y is for Right Arm
T is for Torso
B is for Base
Write a program that takes in an eight character string (via stdin or command line) in the format
HNLRXYTB, where each letter is a digit from 1 to 4 that denotes which preset to use for the corresponding section of the snowperson. Print the full snowperson to stdout.
For example, the input
11114411 is the snowman at the top of the page. (First
1: he has a straw hat, second
1: he has a normal nose, etc.)
Another example, the snowperson for input
_ /_\ \(o_O) (] [)> ( )
Any amounts and combinations of leading/trailing spaces and leading/trailing newlines are allowed as long as...
- the snowperson has all their sections arranged correctly with respect to one another, and
- there are never more than 64 total whitespace characters (the general pattern is only 7×5, so you probably won't hit this limit).
You don't need to print rows/columns of the pattern if they only contain whitespace. e.g. the empty line of the straw hat is not required.
You must use the ordering of the parts as they are given above.
Instead of a program, you may write a function that takes the digit string as an argument. The output should be printed normally or returned as a string.
- You may treat the input as an integer instead of a string if preferred.
The shortest code in bytes wins.
Bonus question: Which of the 65536 distinct snowpeople is your favorite?