18
1
Your task: given an integer n
, generate an embedded hexagon pattern following the below rules, to the nth depth.
An embedded hexagon has the basic shape of this: (n=0
)
__
/ \
\__/
Embedded Hexagons n=1
and n=2
:
____
/ \ \
/\__/ \
\ /
\____/
________
/ \ \ \
/\__/ \ \
/\ / \
/ \____/ \
\ /
\ /
\ /
\________/
The length of each side is 2 times the length of the same side in the previous depth times two. The top and bottom sides are 2 characters long when n=0
and the rest start out as 1 character long. The non top-bottom side lengths should be 2^n
long (OEIS: A000079) and the top and bottom sides should follow the rule 2^(n+1)
(same OEIS).
The current hexagons are 0-indexed, you may chose to use 1-indexed if you want.
This is code-golf, so the shortest answer wins!
@LuisMendo Okay, I'll change the name. – Comrade SparklePony – 2017-04-07T14:10:21.417
It might be hard to handle big input (ex. 64). Is there a limit to
n
? – Matthew Roh – 2017-04-07T15:33:29.823@SIGSEGV There is no limit to n. – Comrade SparklePony – 2017-04-07T16:12:51.820
1Would be amused to see an answer in Hexagony :)) – Mr. Xcoder – 2017-04-07T18:23:52.763
1
Heh, the turtle graphics of my Koch curve submission can do this too (only first function changed). Definitely too long for this, though :)
– Ørjan Johansen – 2017-04-07T18:25:40.787@ØrjanJohansen A long answer is better than no answer! – Comrade SparklePony – 2017-04-07T18:46:37.980
I really like this challenge but am too tired to have a go now and I guess there will be some much better answers than I could make by the time I get a chance to have a go. Much fun to all who try :) – ElPedro – 2017-04-07T19:34:49.200