Your task: make a hexagonal triangle with side length n
, where n
is a positive whole number or 0.
First, let me define a hexagon:
/ \
| |
\ /
(Amazing ASCII art, right?)
Hexagons can be linked together by sharing sides:
/ \ / \
| | |
\ / \ /
/ \
| |
/ \ /
| |
\ /
A hexagonal triangle is the following:
/ \
| |
/ \ / \
| | |
\ / \ /
That hexagonal triangle has a side length of 2-- 2 hexagons are required to make one side. A hexagonal triangle with side-length 1 is just a single hexagon, and a hexagon with side-length 0 is empty.
More formally, a hexagonal triangle is a triangle made of hexagons linked by their sides. The top hexagon links to the two below it on its bottom two sides. The triangle in the bottom left links to the one to its right and top-right, and the one in the bottom right links to the ones on its left and upper left. There are hexagons in between the corner ones, connected by their opposite sides, and their number is n-2
. The triangles are not filled.
More examples:
Side length 3:
/ \
| |
/ \ / \
| | |
/ \ / \ / \
| | | |
\ / \ / \ /
Side length 4:
/ \
| |
/ \ / \
| | |
/ \ / \ / \
| | | |
/ \ / \ / \ / \
| | | | |
\ / \ / \ / \ /
(This triangle isn't really filled, the borders make it look like there is a hexagon in the middle, but there is not.)
Side length 5:
/ \
| |
/ \ / \
| | |
/ \ / \ / \
| | | |
/ \ / \ / \
| | | |
/ \ / \ / \ / \ / \
| | | | | |
\ / \ / \ / \ / \ /
Side length 6:
/ \
| |
/ \ / \
| | |
/ \ / \ / \
| | | |
/ \ / \ / \
| | | |
/ \ / \ / \
| | | |
/ \ / \ / \ / \ / \ / \
| | | | | | |
\ / \ / \ / \ / \ / \ /