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!
n
? \$\endgroup\$