14
1
Challenge
Your task is to output the time (in 12 hour time) in ascii art.
All characters that will be used are as follows:
___ __ ___ ____ _ _ _____ __ ______
/ _ \ /_ | |__ \ |___ \ | || | | ____| / / |____ |
| | | | | | ) | __) | | || |_ | |__ / /_ / /
| | | | | | / / |__ < |__ _| |___ \ | '_ \ / /
| |_| | | | / /_ ___) | | | ___) | | (_) | / /
\___/ |_| |____| |____/ |_| |____/ \___/ /_/
___ ___
/ _ \ / _ \ _
| (_) | | (_) | __ _ _ __ _ __ _ __ (_)
> _ < \__, | / _` | ' \ | '_ \ ' \ _
| (_) | / / \__,_|_|_|_| | .__/_|_|_| (_)
\___/ /_/ |_|
(For each number/symbol individually, consult this gist).
You will receive input in an array of the form:
[hours, minutes, 'am/pm']
. For example,[4, 57, 'am']
, with single quotes only used for am/pm- or
"hours-minutes-am/pm"
. For example,"4-56-am"
- or
[hours, 'minutes', 'am/pm']
for languages that cannot handle leading zeroes on numbers. For example,[4, '07', 'am']
You may use either input method.
Output will be in the form 1 2 : 5 9 am
, where there is one initial space, two spaces between each number (in the gist, each number already has one space on each side), one space between : (colon) and the neighbouring numbers, and one space between the last number and am/pm
, with an optional leading and/or trailing newline. All spaces are between the right-most point of the symbol on the left and the left-most point of the symbol on the right.
Implicit output is allowed.
Lowest byte size wins.
The am/pm
are to be aligned such that the bottom of the p
in pm
is aligned with the bottom of the rest of the output, that is, the undercore denoting the top of am/pm
starts on the third line down (not counting a leading newline).
The colon is to be aligned such that it's first character (an underscore) starts on the second line down (not counting a leading newline).
For minutes < 10
, output the minutes with a leading 0
(you should receive this in the input). For example, [8, 04, 'pm']
-> 8 : 0 4 pm
.
You must not fetch the data for the numbers from a library or external resource. All data must be contained within the program.
For example, for the input [12, 47, 'am']
, the output would be as follows:
__ ___ _ _ ______
/_ | |__ \ _ | || | |____ |
| | ) | (_) | || |_ / / __ _ _ __
| | / / _ |__ _| / / / _` | ' \
| | / /_ (_) | | / / \__,_|_|_|_|
|_| |____| |_| /_/
(If you see any edge cases that you can't decide what to do with, please post in comments and I will add them to examples).
2
Possible duplicate of Render "Digital Clock Style" Numbers
– Mego – 2016-02-16T07:28:06.987@Mego you reckon? That question simply says render (any) number as (very) basic ascii art. This question beefs up the ascii art, adds the am/pm and colon, and specifies input with an array with a mix of types. – None – 2016-02-16T07:32:36.983
Specifically: that question is clock-style numbers. This question is actual time, with all the right formatting. – None – 2016-02-16T07:33:06.877
The different format of the numbers and the addition of the colon and am/pm do little to differentiate the challenges imo. The main part of the challenge is still converting integers to ascii art. – Mego – 2016-02-16T07:34:13.653
So,
[12, 47, 'pm']
should output12:47 am
? – wizzwizz4 – 2016-02-16T08:00:12.7079@Mego I don't think this is a duplicate. The other challenge has that ultra simple formatting (even compressable as binary). This one will probably get more kolmogorov-complexity-like answers. – PurkkaKoodari – 2016-02-16T08:50:25.610
@wizzwizz4 aaargh! fixed. thanks for the heads up. – None – 2016-02-16T09:07:38.607
How do we receive arguments in languages without arrays? Or with arrays but without tuples? (Your example 'array' has elements of different types, unlike arrays in just about any language that exists) – Toby Speight – 2016-02-16T09:37:50.267
@TobySpeight would "12-47-am" work in most languages? – None – 2016-02-16T09:40:35.023
@MathiasFoster I would recommend that you allow any input (within reason), but that you have the deciding vote on it, and if somebody uses input that trivialises the question, tell them and enforce it. – wizzwizz4 – 2016-02-16T14:38:33.013
I guess the program has to output a leading 0 for the number of minutes, if needed? (e.g.
10, 9, 'am'
=>10:09am
). What about leading 0 for hours (e.g.8, 9, 'am'
)? Have to insert 0? Have to insert a space? Have to insert either a space or zero? Can assume the input already contains the leading zero or space? – anatolyg – 2016-02-16T16:13:23.647@anatolyg question updated. basically no leading 0 for hours, there is one for minutes but you'll receive it in the input, so treat it as normal. – None – 2016-02-16T18:58:18.760
Can we have trailing space in the output? – J Atkin – 2016-02-17T14:52:06.290
@JAtkin thats fine, as long as it looks exactly as it should. – None – 2016-02-17T18:59:38.130