25
2
See also: Rotatagons
Challenge
Given a string as input, output its wordagon.
Wordagons
A wordagon is a way of representing a string in a hexagon. Now, let's create a wordagon from the string hexa
:
Firstly, you start with the first character in the string a place it in the centre:
h
Then, you take the next character in the string and add a hexagonal layer:
e e
e h e
e e
Then, add the next layer:
x x x
x e e x
x e h e x
x e e x
x x x
Finally, add the last layer:
a a a a
a x x x a
a x e e x a
a x e h e x a
a x e e x a
a x x x a
a a a a
And you now have the wordagon for the string hexa
.
Examples
Here's some I prepared earlier:
hello
o o o o o
o l l l l o
o l l l l l o
o l l e e l l o
o l l e h e l l o
o l l e e l l o
o l l l l l o
o l l l l o
o o o o o
PPcg
g g g g
g c c c g
g c P P c g
g c P P P c g
g c P P c g
g c c c g
g g g g
o *
* * *
* *
* o *
* *
* * *
(T_T)
) ) ) ) )
) T T T T )
) T _ _ _ T )
) T _ T T _ T )
) T _ T ( T _ T )
) T _ T T _ T )
) T _ _ _ T )
) T T T T )
) ) ) ) )
Note that trailing and/or leading newlines are allowed.
Winning
The shortest code in bytes wins.
14Bonus points if someone does this in Hexagony? ;) – Kevin Cruijssen – 2016-09-05T12:46:54.093
Can the input string contain linefeeds? I don't think it would pose any implementation problem, just produce invalid wordagons – Aaron – 2016-09-05T12:52:58.420
@Aaron No, the input string will never include newlines – Beta Decay – 2016-09-05T12:57:59.163
is it ok if the output is a string with newlines returned from a function? – Daniel – 2016-09-06T01:24:34.990
@Dopapp Yes, that's fine – Beta Decay – 2016-09-06T08:32:24.733
@KevinCruijssen You could always start a bounty ;) – Beta Decay – 2016-09-06T11:46:47.677
2Aww. I'm disappointed because I read the title as "word-dragons"... – mbomb007 – 2016-09-06T21:47:16.930