Congratulations! You've just been hired by NASA to work on the new Horizons 2 project.
Sadly, there have been huge budget cuts recently, so the top management has decided to fake the whole planned Pluto flyby (as they did for the moon landings in the 70s).
Your task is to write a program that will accept as input a date in the format yyyymmdd
, and will provide a fake photograph of Pluto for this date. You can assume the entered date will be in the year 2015 or 2016.
The photograph is a 15x15 grid of ASCII characters. The characters on the grid have their x- and y-coordinates within the range [-7, 7]
- the top-left character is at (-7, -7)
while the bottom-right character is at (7, 7)
.
The photograph will be computed with the following rules:
- The probe will be the nearest to Pluto on 25/12/2015
- The distance
d
to Pluto is given by this formula :square root of ((difference in days to christmas) ^ 2 + 10)
- The radius
r
of Pluto's image on the photo is given by :22 / d
- A character with coordinates
(x, y)
on the grid must be set to#
ifx^2 + y^2 <= r^2
; it must be set to space otherwise. - There are stars at positions
(-3, -5)
,(6, 2)
,(-5, 6)
,(2, 1)
,(7, -2)
. Stars are represented by a dot.
, and they are of course hidden by Pluto.
One more thing: The NASA board has come to the conclusion that the discovery of life on Pluto would likely result in a substantial budget increase. Your program should then add clues of life on Pluto:
- When the distance to Pluto is <= 4, add a plutonian at coordinates
(-3,-1)
:(^_^)
Example photograph for input 20151215
: (Your code should have all the newlines as this code does)
.
# .
###
#####
###.
# .
.
Photograph for input 20151225
:
#######
#########
###########
#############
#############.
###(^_^)#####
#############
#############
#############
#############
###########
#########
. #######
As a comparison, here's a photo of Pluto's satellite Hydra as taken by New Horizons. Differences are hardly noticeable with our ASCII art.
This is code golf, so the shortest code in bytes wins!
`
s in favour of<pre><code>
; feel free to roll back if you don't like it. \$\endgroup\$You can assume the entered date will be in the year 2015 or 2016.
But then why specify a year at all? \$\endgroup\$