20
1
Challenge
Given the phase of the moon, draw it using ASCII art.
Your program must handle new moon, waxing crescent, first quarter, waxing gibbous, full moon, waning gibbous, last quarter, and waning crescent. Your input will be an integer.
0 -> new moon
1 -> waxing crescent
2 -> first quarter
3 -> waxing gibbous
4 -> full moon
5 -> waning gibbous
6 -> last quarter
7 -> waning crescent
The ASCII art is all placed on a 16x8 grid (because character dimension ratios). You can replace .
with any character and #
with any other non-whitespace character.
The output for new moon should be:
................
................
................
................
................
................
................
................
For waxing crescent:
..........######
............####
.............###
.............###
.............###
.............###
............####
..........######
For first quarter:
........########
........########
........########
........########
........########
........########
........########
........########
For waxing gibbous:
......##########
....############
...#############
...#############
...#############
...#############
....############
......##########
And for full moon:
################
################
################
################
################
################
################
################
The waning crescent is just the waxing crescent with each line reversed, as with the waning gibbous and the waxing gibbous, and the first and last quarter.
Rules
- Standard Loopholes Apply
- You may choose to output waxing/waning in the opposite direction if you want, though it should make no difference (the graphics shown in this question are for the northern hemisphere)
- Your output must be exactly as specified. Your newlines can be any reasonable line separator, and you may have a trailing newline if you would like.
5Relevant xkcd. – Martin Ender – 2017-05-17T05:55:43.500
"though it should make no difference" - saved me a byte (I hope I got it right) :) – Jonathan Allan – 2017-05-17T09:19:01.480
1Does it have to be ASCII art?
MoonPhase["Icon"]
is 17 bytes in Mathematica… – Not a tree – 2017-05-17T10:27:02.470@JonathanAllan Oh nice. Well then it might make a difference :P – HyperNeutrino – 2017-05-17T11:33:33.320
@lanlock4 You stated one of the reasons why I made it ASCII art. Also yes it does have to be ASCII art. – HyperNeutrino – 2017-05-17T11:34:13.800