You don't want to pay money for the expensive architectural program, so you decide to roll your own. You decide to use ASCII to design your buildings. Your program will take in a single string formatted in a specific way, and the program will output the building.
Input
Input consists of a single line of characters. It can be assumed to only contain the letters a-j
, the numbers 1-9
, and the symbols -
and +
.
Output Description
For each letter a-j
, the program will output a vertical line as follows. We will call this a column.
.
..
...
****
*****
******
-------
--------
+++++++++
++++++++++
abcdefghij
For instance, the input abcdefgfedefghgfedc
would output:
.
* ***
*** *****
***** *******
---------------
-----------------
++++++++++++++++++
+++++++++++++++++++
A letter may be prefixed with a positive integer n
, which will add n
whitespace characters below the column. We will call this an offset. For instance, using S
to notate a whitespace, the input 3b2b3b
would output:
+ +
+++
S+S
SSS
SSS
A letter may also be prefixed with a negative integer -m
, which will remove the bottom m
non-whitespace characters of the column (not replace them with whitespace, remove them entirely). We will call this a slice. For instance, the input -1j-2j-3j-4j-5j-6j-7j-8j
would output:
.
..
...
*...
**...
***...
-***...
--***...
+--***..
An offset and a slice can be applied to the same line, but the offset must go first. In other words, the letter may be prefixed with n-m
, where n
is the size of the offset, and m
is the size of the slice. For instance, using S
to notate a whitespace, the input '2-4j' would output:
.
.
.
*
*
*
S
S
Lastly, the +
operator used between two columns indicates that they should be stacked on top of each other in the same column instead of in seperate columns. For instance, the input `2-4ja' outputs:
.
.
.
*
*
*
S
S+
Whereas the input 2-4j+a
outputs:
+
.
.
.
*
*
*
S
S
Here is a sample input:
abiehef+ehfhabc
And the resultant output:
*
-
. -
. . +. .
* * +* *
* * ****
********
--------
-------- -
+++++++++ ++
+++++++++++++
Looks like an old destroyed castle tower of some sort.
Here is another sample input:
6b5b+a6b1-2d+3-4f1-2d+-2c+2-4f+1-2d+-2c2-2d+1-4g+1-2c+b+-2c+-4e2-7j+-4g+d+-2c+-4f2-7j+-5h+b+-2c+a+-3f2-7j+-7i+-4e+b+b+a+-4f2-7i+a+-7h+-4f+b+b+a+-4f2-7j+-7h+-4f+a+-7h+a+-7i+-4f2-7j+-7i+-6h+a+-7i+b+-4e3-7i+a+-7h+-4e+a+-7h+b+1-7h3-7j+1-4f+-7h+b+-4f+a3-7j+2-4f+a+-4f+b3-2d+-2d+3-4g+b3-2d+-2d+-2c
And the resultant output:
****** +++
******+.*++
---++.+ ***
-+-+++..++**
-+--+++.+++*
--++++.+..*
+++++.+**
+++****.****** -
+++*****.**.. --
+ ***....+..--
...+.....--
--.........--
---......
--
(It was supposed to be Mario but didn't turn out very good...)
If the specification still isn't clear, I have a non-golfed implementation written in Python 2.7. You can run it and experiment to get a feel for how the specification works. You may also choose to laugh at my programming skills.
This is code-golf, so shortest entry wins. Ask questions in comments if unclear.
a+a+a+a+a
would output five plus signs on top of each other. \$\endgroup\$