HexaGolf: Wordagons
Python 2, 83 bytes
s=input()
l=len(s)
while 1:l-=1;y=abs(l);print' '*y+' '.join(s[:y:-1]+s[y]*y+s[y:])
Prints the wordagon and then crashes (which only prints to STDERR).
Example:
% python2.7 wordagon.py <<<'"abcde"' 2&>/dev/null
e e e e e
e d d d d e
e d c c c d e
e d c b b c d e
e d c b a b c d e
e d c b b c d e
e d c c c d e
e d d d d e
e e e e e
xnor saved 5 bytes. Thanks!
Vim, 92 bytes
:se ri|s/./ &/g
ⓋCⓇ"Ⓓ␛$vpmlmrqqYpi ␛`ljxxhmlylv`rjlmr:s/\%V\(.\)./Ⓡ" /g
@qq@qVdy2G:g/^/m0
Gp
Circled letters represent Control + letter; ␛ is escape.
Mathematica 100 219 bytes
If ASCII-Art need not be Terminal-Art this should be valid.
My earlier submission mistakenly drew a star rather than a hexagon. I can't see how I was so off!
c = CirclePoints@6;
f@s_:=Graphics[{Text[s~StringPart~1,{0,0}],Flatten@Table[Text[StringPart[s,n+1],#]&/@Subdivide[Sequence@@#,n]&/@Partition[Riffle[(n)CirclePoints@6,RotateLeft[n CirclePoints@6]],2],{n,1,StringLength@s-1}]},BaseStyle->20]
CirclePoints@6
returns the vertices of a unit hexagon, assuming that the center is at the origin.
Subdivide
ing the coordinates for neighboring vertices finds equally spaced positions along the respective edge.
A counter from 1 through the StringLength -1
of the input string allows each layer of the wordagon to be handled separately.
As n
increases, so does the respective distance of each vertex from the origin.
Text[s~StringPart~1,{0,0}]
prints the first letter of the input at the origin.
f@"Wordagon"
For the curious, this is what the star version looked like. I know, it was way off the mark. It only showed the letters at the hexagon's vertices.
Graphics@Table[Text[Style[StringPart[#, r + 1], 54], r {Cos@t, Sin@t}], {t, 0, 2π, π/3}, {r, 0, StringLength@# - 1}] &["Hexa"]