Winter is fast approaching with many places receiving the first layers of snow for the 15/16 season, so why don't we break out the snow machines and code ourselves some snow?
Given a integer
n via STDIN, output an ASCII representation Beta's snowflake (as described below) at level
The snowflake starts off at level 0 with a single x:
Then, on each corner you add one of these shapes:
You add the above shape to a top right corner. For a bottom right corner, rotate it 90° clockwise, for bottom left, 180° clockwise and for top left, 270° clockwise.
If you do that, you get the following shape:
x x xx xx x xx xx x x
Take note of the orientation of the shapes. Carrying on we add more of the shapes to each corner, using the orientation rules described above, to the diagram to get level 2:
x x x xxxxxxx xx x x xx xxx xxx xx x xx xxx xxx xx x x xx xxxxxxx x x x
Note that the shapes are only added to
xs with two or more exposed sides (which is referred to as a corner above).
The L-shapes may and will overlap for values of
n greater than 1. For example:
If level 0 is:
Then there must be overlaps in level 1 (indicated with an
o, do not include the
o in your output):
x o x xxxoxxx x x xxxoxxx x o x
Your task is to output this ASCII representation of Beta's snowflake.
There will be a 50 rep bonus for the shortest program which, when
n is negative, outputs the snowflake (at level
n*-1) as an image or graphically to the screen.
You may have a separate programs for the bounty and the main task.
The shortest program in bytes wins.