20
1
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:
/ \
| |
/ \ / \
| | |
/ \ / \ / \
| | | |
/ \ / \ / \
| | | |
/ \ / \ / \
| | | |
/ \ / \ / \ / \ / \ / \
| | | | | | |
\ / \ / \ / \ / \ / \ /
22If there isn't a Hexagony answer for this, I will lose all faith in @MartinEnder. – caird coinheringaahing – 2017-04-23T20:00:16.047
@Soyoucanreplytomeincomments Let's just say if I could folow users on here, they'd be on the list. – phyrfox – 2017-04-23T20:04:48.710
1
@phyrfox You can, sort of.
– Dennis – 2017-04-23T21:19:24.2232I expect to see a short answer in Charcoal. I'd do it myself, but I'd have to learn it first, and I want to watch a movie instead, sorry. – Neil – 2017-04-23T21:20:15.017
3@Neil you are forgiven for not learning an entirely new programming language. But that's your first warning! – caird coinheringaahing – 2017-04-23T21:58:28.907
Is any amount of trailing whitespace allowed on each line? – math junkie – 2017-04-23T22:51:01.960
@mathjunkie trailing whitespace is fine. – Comrade SparklePony – 2017-04-23T22:51:51.190
@Soyoucanreplytomeincomments No pressure or anything... – Martin Ender – 2017-04-24T18:22:06.613