HexaGolf: Rotatagons See also: Wordagons

Challenge

Given a hexagon and a number n as input, output the same hexagon rotated n times.

Hexagon

The hexagon will be a string like so:

  a b c
 d d e e
f f o g g
 h h i i
  j k l


The hexagon will always be regular and will only ever contain the printable ASCII characters:

 !"#$%&amp;'()*+,-./0123456789:;&lt;=&gt;?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~


Rotation

To find how much to rotate the hexagon by, multiply n by 60 degrees to get the angle of rotation. For example, using the above hexagon, if n is 2, we multiply that by 60 to get 120 degrees. Then, we rotate the hexagon by 120 degrees:

  j h f
 k h f d
l i o d a
 i g e b
  g e c


Note that each side has moved two sides clockwise.

If n is positive, you should rotate the hexagon clockwise. If n is negative, you should rotate the hexagon anticlockwise.

n will always be an integer in the range -6 to 6 inclusive.

Examples

Input:

  . u .
 .  |  .
l - + - r
 .  |  .
  . d .


n = 3

  . d .
 .  |  .
r - + - l
 .  |  .
  . u .




Input:

  - - -
 /     \
&lt;       &gt;
 \     /
  - - -


n = -1

Output:

  - \ &gt;
 -     /
-       -
 /     -
  &lt; \ -




Input:

   h e x a
  g o n s a
 n d t r i a
n g l e s m a
 k e m e s a
  d l y m a
   d d e r


n = 6

Output:

   h e x a
  g o n s a
 n d t r i a
n g l e s m a
 k e m e s a
  d l y m a
   d d e r


Winning

The shortest program in bytes wins.
Python 2, 160 158 156 148 124 bytes
Prepare to be amazed! The resulting text is drawn on a canvas... by a Turtle! :D

from turtle import*
h,n=input()
up()
rt(n*60)
l=0
for c in h:
 write(c);fd(9);l-=1
 if&quot; &quot;&gt;c:fd(9*l);rt(90);fd(15);lt(90);l=0

Try it online - Supports decimal rotations as well!

If you would prefer the turtle to be shaped like one, you can add the line t.shape(&quot;turtle&quot;).
View the revision history to see past versions.
Aliases used:
up() - penup()
rt() - right()
lt() - left()
fd() - forward()
bk() - backward()
Thanks to Sherlock9 for the suggestions!