If you throw an ASCII egg in a given direction, you end up with an ASCII splat of size n. It "starts" with one
o (the yolk), and continues in a given direction with "lines" consisting of 2 up to n
*'s are separated by one "space", and the
o and all the "lines" of
*'s are separated by "lines" of "space".
The direction of the splat can be any one of eight directions from
o, for example:
1 2 3 4 o 5 6 7 8
Here are examples of ASCII splats of size 4 in directions
3 respectively. On the left is the actual ASCII splat, and on the right is the same splat but with the "lines" of "space" replaced with actual "lines" (i.e.
| depending on the direction) just to clarify what is meant by a "line" of space.
Size 4, direction 5 * | | |* * | |*| * * |*| |* o * o| |*| * * |*| |* * | |*| * | | |* Size 4, direction 2 * * * * * * * * ------- * * * * * * ------- * * * * ------- o o Size 4, direction 3 * * \ * * *\* \ \ * * * *\*\* \ \ \ o * * * o\*\*\*
Given n ≥ 1 and one of the 8 possible directions, write a function or program that outputs the ASCII splat of size n in the given direction.
Input and output
Any consistent, reasonable input format is allowed. You don't need to map directions to the integers 1 to 8 in the same way I did - if some other way of specifying the direction is easier, go ahead. But say what you did if it isn't clear.
The output will consist of
*, spaces (U+0020) and newlines (U+000A) that produce the ASCII splat. Leading, trailing, otherwise extra whitespace is permitted on any line.
This is code-golf. Standard rules apply.
Size 1, any direction o Size 3, direction 6 * * o * * * Size 5, direction 7 o * * * * * * * * * * * * * *