16
1
In today's episode of AAOD, we are going to construct a Chinese Shrine of varying heights.
Consider the following examples for height (N
) 1
to 6
N = 1
:
.
|
. ]#[ .
\_______/
. ]###[ .
\__]#.-.#[__/
|___| |___|
|___|_|___|
####/_\####
|___|
/_____\
N = 2
:
.
|
. ]#[ .
\_______/
. ]###[ .
\___________/
. ]#####[ .
\___]#.---.#[___/
|__|_| |_|__|
|__|_|___|_|__|
#####/___\#####
|_____|
/_______\
N = 3
:
.
|
. ]#[ .
\_______/
. ]###[ .
\___________/
. ]#####[ .
\_______________/
. ]#######[ .
\____]#.-----.#[____/
|__|__| |__|__|
|__|__|_____|__|__|
######/_____\######
|_______|
/_________\
N = 4
:
.
|
. ]#[ .
\_______/
. ]###[ .
\___________/
. ]#####[ .
\_______________/
. ]#######[ .
\___________________/
. ]#########[ .
\_____]##.-----.##[_____/
|__|__|_| |_|__|__|
|__|__|_|_____|_|__|__|
########/_____\########
|_______|
/_________\
N = 5
:
.
|
. ]#[ .
\_______/
. ]###[ .
\___________/
. ]#####[ .
\_______________/
. ]#######[ .
\___________________/
. ]#########[ .
\_______________________/
. ]###########[ .
\______]###.-----.###[______/
|__|__|___| |___|__|__|
|__|__|___|_____|___|__|__|
##########/_____\##########
|_______|
/_________\
N = 6
:
.
|
. ]#[ .
\_______/
. ]###[ .
\___________/
. ]#####[ .
\_______________/
. ]#######[ .
\___________________/
. ]#########[ .
\_______________________/
. ]###########[ .
\___________________________/
. ]#############[ .
\_______]####.-----.####[_______/
|__|__|__|__| |__|__|__|__|
|__|__|__|__|_____|__|__|__|__|
############/_____\############
|_______|
/_________\
and so on.
Construction Details
I am sure most of the details about the pattern are clear. Here are some finer details:
- The door at the bottom of the shrine can at minimum be of
1
_
width and at maximum be of5
_
width. - There will always be two
.
directly above the pillars around the door (two vertical|
). - The stairs start with the same width as the door and increase like show in the pattern
- The
]##..##[
blocks above each roof level increase in size of2
from top to bottom. - The
\__...__/
roofs levels increase in size of4
from top to bottom. - The walls blocks around the door should at minimum contain
1
_
and at maximum,3
_
between the two|
. Priority goes to the outer wall blocks so that the one closest to the door gets a varying size for each level. - The space between the
.
and the]
(or[
) is filled by#
in the roof just above the doors.
Challenge Details
- Write a function or full program that reads a positive integer greater than
0
via STDIN/ARGV/function argument or closest equivalent and outputs (to STDOUT or closest equivalent) theN
th Chinese Shrine - Trailing newline is optional.
- There should either be no trailing spaces or enough trailing spaces to pad the output in the minimum bounding rectangle.
- There should not be any leading spaces that are not part of the pattern.
Leaderboard
The first post of the series generates a leaderboard.
To make sure that your answers show up, please start every answer with a headline, using the following Markdown template:
# Language Name, N bytes
where N
is the size of your submission. If you improve your score, you can keep old scores in the headline, by striking them through. For instance:
# Ruby, <s>104</s> <s>101</s> 96 bytes
The door width seems rather arbitrary to me - why is it 1 in the
N=1
case? Why not 3 and have smaller side windows like in theN=2
case? – Matty – 2015-05-22T13:49:22.430Also, in the
N=1
case, isn't the first rooftop too long (wide)? – Matty – 2015-05-22T13:58:28.320@Matty regarding door - if door was of width 3, then there would be no
#
beside the.
to support the]
and[
above it. About the starting roof size - That is the roof size in each height's top roof. – Optimizer – 2015-05-22T14:00:26.743I was asking about the bottom most roof just above the windows. In all other cases it is the size of the roof above it +4 (+2 on either sides). But here it is +8. – Matty – 2015-05-22T14:18:11.313
@Matty oh, you are right. Fixed. – Optimizer – 2015-05-22T14:21:47.173
Why do the
N=2
andN=4
cases have leading spaces? – Reto Koradi – 2015-05-23T17:16:08.787@RetoKoradi because ASCII art and markdown don't go along ? Thanks for pointing out! Fixed! – Optimizer – 2015-05-23T17:20:09.993