ASCII art H trees
Charcoal, 22 bytes
P-²FNF²«⟲T²+×⁺²κX²ι←‖O
Try it online! Link is to verbose version of code. 0-indexed. Explanation:
P-²
Print the initial three -
s, leaving the cursor in the middle.
FN
Repeat for the number of times given.
F²«
Repeat twice for each H
. Each loop creates a slightly bigger H
from the previous loop, but we only want alternate H
s.
⟲T²
Rotate the figure.
+×⁺²κX²ι←
Draw half of the next line.
‖O
Reflect to complete the step.
The result at each iteration is as follows:
---
| |
+---+
| |
-+- -+-
| |
+-----+
| |
-+- -+-
| | | |
+-+-+ +-+-+
| | | | | |
| |
+-------+
| |
| | | | | |
+-+-+ +-+-+
| | | |
-+- -+- -+- -+-
| | | |
+--+--+ +--+--+
| | | | | |
-+- | -+- -+- | -+-
| |
+-----------+
| |
-+- | -+- -+- | -+-
| | | | | |
+--+--+ +--+--+
| | | |
-+- -+- -+- -+-
Canvas, 20 19 bytes
ø⁸«╵[↷L⇵;l⇵└┌├-×╋‼│
Try it here!
Explanation:
ø push an empty canvas
⁸«╵[ repeat input*2 + 1 times
↷ rotate clockwise
L⇵ ceil(width/2)
;l⇵ ceil(height/2); leaves stack as [ ⌈½w⌉, canvas, ⌈½h⌉ ]
└┌ reorder stack to [ canvas, ⌈½w⌉, ⌈½h⌉, ⌈½w⌉ ]
├ add 2 to the top ⌈w÷2⌉
-× "-" * (2 + ⌈w÷2⌉)
╋ in the canvas, at (⌈w÷2⌉; ⌈h÷2⌉) insert the dashes
‼ normalize the canvas (the 0th iteration inserts at (0; 0) breaking things)
│ and palindromize horizontally