Instructions
2015 has been quite a year for elixir, and we wanted a way to celebrate the comming New Year. We are thrilled that this weeks puzzle was dreamed up by one of our contributors, @stoftis. So if you have any puzzle ideas let us know, through email or twitter https://twitter.com/elixirgolf.
The puzzle is to create a countdown timer that displays the number of Days:Hours:Minutes:Seconds
until the next New Year. This countdown timer will decrease every second until
000:00:00:00
.
$ elixir countdown.exs
013:05:49:08
Rules
- The code will be executed using the
elixir countdown.exs
terminal command. We will manually copy all your solutions into this file, so please just submit your solutions as below. - The timer will be in the following format
Days:Hours:Minutes:Seconds
- The time should be represented as numbers, separated by colons:
000:00:00:00
- Every second the timer should decrease by 1 second, and all the other fields should adjust accordingly:
013:05:00:01
013:05:00:00
013:04:59:59
013:04:59:58
..
..
000:00:00:03
000:00:00:02
000:00:00:01
000:00:00:00
- The timer should only display one timer at any time, i.e. it should have some mechanism to clear the screen or update itself every second. It should NOT display a long list of times, like the example above.
- The timer should countdown to the next New Year e.g. January 1st 2016.
Bonus Credits
As a bit of fun and a side project maybe consider the following flourishes:
- Colour the numbers
- Allow the countdown timer to dynamically adjust to the following New Year after this one
- Trigger some exciting output when the countdown reaches
000:00:00:00
.
Submit your solution
Please submit your solution as a comment on the Github issue below, along with your Twitter handle (we will use this to link back to you if your solution is successful).
Solutions
Winner
--- your name here ---
Honourable mentions
Resources
- Wikipedia New Year https://en.wikipedia.org/wiki/New_Year
- Example web countdown timer: http://www.timeanddate.com/countdown/newyear