Remember those fun pinwheels that you blow on and they spin round and round? Let's code one!
A pinwheel will have the set of characters \ | / _
drawing its center and arms. One possible pinwheel could look like this:
|
|
|_ ___
___|_|
|
|
|
But what's a pinwheel that doesn't spin? No fun! We can make it spin by rearranging the symbols:
/
\ /
\ /
\/\
\/\
/ \
/ \
/
The challenge is to create a program that takes three integers and outputs a pinwheel as specified below. The first of these is the number of arms it has, the second is the length of the pinwheel's arms, and the third is the number of times it will spin one-eighth of a revolution clockwise.
You can assume the following:
- The number of arms will always be 0, 1, 2, 4, or 8.
- All the arms will be equally spaced apart from each other.
The initial position of the pinwheel will have its center like this:
_ |_|
If the number of arms is 1, you may decide which direction the arm points.
- If the number of arms is 2, you may decide to make the arms point vertically or horizontally.
You can write a full program that takes input through STDIN or command-line argument, or a function that takes input through function arguments. Your program must show a sequence of outputs that shows the pinwheel spinning, each separated by at least one empty line. The center of the pinwheel should not move by more than one space. You may output as many leading and trailing spaces as necessary.
Here are some examples:
0 2 1
_
|_|
/\
\/
1 3 2
|
|
|_
|_|
/
/
/
/\
\/
_ ___
|_|
2 2 0
_ __
__|_|
8 4 1
\ | /
\ | /
\ | /
\|_/____
____|_|
/ |\
/ | \
/ | \
/ | \
| /
\ | /
\ | /
\ |/
____\/\____
\/\
/| \
/ | \
/ | \
/ |
This is code golf, so shortest code wins. Good luck!
1 3 5
and the arm initially pointing up), spaces will need to be prepended in earlier outputs to accommodate for this. \$\endgroup\$