# The Microwave Challenge

Inspired by this comment.

# Input

The number of seconds on the timer.

# Output

Here's our basic microwave:

 _____________________________________________________________
|                                             |  ___________  |
|                                             | | [display] | |
|     ___________________________________     | |___________| |
|    |                                   |    | |   |   |   | |
|    |                                   |    | | 1 | 2 | 3 | |
|    |                                   |    | |___|___|___| |
|    |                                   |    | |   |   |   | |
|    |                                   |    | | 4 | 5 | 6 | |
|    |                                   |    | |___|___|___| |
|    |                                   |    | |   |   |   | |
|    |                                   |    | | 7 | 8 | 9 | |
|    |                                   |    | |___|___|___| |
|    |                                   |    | |   |       | |
|    |                                   |    | | 0 | Start | |
|    |                                   |    | |___|_______| |
|    |                                   |    |  ___________  |
|    |___________________________________|    | |           | |
|                                             | |           | |
|                                             | |___________| |
|_____________________________________________|_______________|


You should replace [display] with:

• The time left to cook in the format minutes:seconds if there is any time left.
• The system time in hours:minutes if the time left is 0.

# Rules

• The display can be aligned in either direction, but the vertical bars need to align with the ones above them.
• You may assume that the input will never be negative and never exceed 59,999,999.
• No leading zeroes before a cook time. Remove the minutes and the colon for inputs less than 60.
• Use 12-hour time UTC with no leading zeroes for the system time.
• Trailing whitespace is allowed.
• Since this is , the shortest answer in bytes wins.

# Display test cases

You should, of course, print the entire microwave along with the display, and it should work for any input within the boundaries, but here are some test cases for the display:

Input     Display
100       1:40
59        59
60        1:00
120       2:00
59999999  999999:59
1         1
0         [show system time]

UTC Time  Display
00:00     12:00
01:00     1:00
13:04     1:04

• I was hoping to see this in the Sandbox where I was going to suggest that the display be "animated", taking input as seconds, starting the display in minutes & seconds and then counting down to 0 seconds. Dec 2 '17 at 19:56
• @Shaggy It was posted in the sandbox yesterday. Dec 2 '17 at 20:03
• Ah, nuts, I missed it :( Dec 2 '17 at 20:04
• Can we center the display time rather than just leaving 1 space between it and |? I.e is |<equal number of spaces>8:35<equal number of spaces>| acceptable in place of | 8:35<more spaces>|? Moreover, it's nicer :-) Dec 2 '17 at 20:36
• @Mr.Xcoder The display should be padded with spaces on either side you want (or even a combination of the two) to make it 9 characters. I thought the rules made that clear. Dec 2 '17 at 20:38

# JavaScript (ES6), 345 342 bytes

Saved 2 bytes thanks to @StephenLeppik

n=>[...'lmnopqsuvwxyz{}~'].reduce((s,c)=>(x=s.split(c)).join(x.pop()), p{{yyvu{ xvs${(n&&n<60?n+'':(k=n||new Date/6e4|0,k/60%(n?k:12)|0||(n?0:12))+':'+('0'+k%60).slice(-2)).padEnd(9)}xoup__uuxx{~zzn1s2s3wn4s5s6wn7s8s9wuuq 0sStartmy_~ { oxp__zxllx{|x |p{_|{y_|qox}}}uzs}uuuuu {yyy__z|u y___s|wm|y~zzv |}}}}xu sx q~|p{{{ox znzq m qy|ylx}|xv)  ### Test cases let f = n=>[...'lmnopqsuvwxyz{}~'].reduce((s,c)=>(x=s.split(c)).join(x.pop()), p{{yyvu{ xvs${(n&&n<60?n+'':(k=n||new Date/6e4|0,k/60%(n?k:12)|0||(n?0:12))+':'+('0'+k%60).slice(-2)).padEnd(9)}xoup__uuxx{~zzn1s2s3wn4s5s6wn7s8s9wuuq 0sStartmy_~ { oxp__zxllx{|x
|p{_|{y_|qox}}}uzs}uuuuu {yyy__z|u y___s|wm|y~zzv
|}}}}xu  sx q~|p{{{ox
znzq m qy|ylx}|xv)

O.innerText = [100, 59, 60, 120, 59999999, 1, 0].map(f).join('\n');
<pre id=O></pre>

# SOGL V0.12, 151 150 bytes

╔*:@ΚG┐∙+;┐Κ+Γ╬5□
‽uS9w'+*;5wι+}:'+÷;'+%lH⁵!+‽ 0Κ}⁴‽ι}⁰ :∑ā;'!3ž"∑⅓/«juΒ  v←>k─z“M»─4n{_□}4Δ№{' ;3*I:A26□'$a22□}'(7«■ _čž'&'¹"<Ξ‘⁾žL∫L%F3‰4*'℮+f3÷⁽3*ž  Try it Here! Explanation:  □ a function which draws a rectangle uses of the stack [xPos, yPos, height-1, (width+1)/2] the width everywhere luckily is an odd number ╔* repeat "_" width times : create a duplicate of that @Κ prepend a space to it G get the height on top of the stack ┐∙ repeat "|" vertically that many times + add that below the " ___..." ; get the other copy of the underscores ┐Κ prepend "|" to it + and add that below the rest Γ palindromize horizontally with 1 overlap ╬5 place that at the coords [xPos; yPos], without overwriting spaces system time ‽ } if the input isn't 0 uS push date & time stuff — [year, month, day, hour, minute, second, milliscond, weekday, hours in 12-hour time, am(= 0)/pm(= 1)] 9w get the 9th element — hours in 12-hour time '+* multiply by 60 ; get the array on top again 5w get the 5th item — minutes ι pop the array + add the minutes to hours*60 time formatting : duplicate the time (result of above or input) '+÷ divide by 60 ; get the other time copy '+% mod by 60 l get the length of the minutes H decrease it — truthy if the minutes are a single digit ⁵! negate the hours — truthy if the hours aren't 0 + add those — acts like OR — truthy if minutes are a single digit or hours aren't 0 ‽ } if not that 0Κ prepend 0 to the minutes ⁴ get a copy of the hours ‽ } if equal to 0 ι pop the hours ⁰ wrap the stack in an array :∑ join with ":" ā; push an empty array below the time — the main canvas '! push 51 3 push 3 ž at [51; 3] in the canvas insert the time main microwave body "...“ push 196046633463872206014875356167606 M»─ base 50 decode — [1,1,19,31,6,4,13,18,1,1,19,23,49,2,1,6,49,17,2,6] 4n group 4 items — [1,1,19,31],[6,4,13,18],[1,1,19,23],[49,2,1,6],[49,17,2,6] { } for each group _ put the arrays contents on the stack □ execute the rectangle making function boxes for the numbers 4Δ push [1,2,3,4] № reverse — [4,3,2,1] { } for each ' ; push 49 below the current number — X pos 3* multiply the current number by 3 I and increment it — Y pos :A save a copy of that on variable A (for the next rectangle) 26□ create a rectangle at [49; cnum*3+1] with width 11 and height 3 '$         push 53 — X pos
a        push A — Y pos
22□     create a rectangle at [53; cnum*3+1] with width 3 and height 3
'(7«■  _              push 57, 14 and "  _"
č             chop the string into chars (aka make it vertical)
ž            insert that at [57; 14] in the canvas
'&'¹"..‘    push 55, 15, "start"
⁾   uppercase the first letter of "start"
ž  insert that at [55; 15] in the canvas

number inserting
L∫                   for each in 1..10, pushing counter
L%                   push counter % 10 — the drawn digit
F3‰                push (counter-1)%3 + 1
4*              multiply that by 4
'℮+           and add 47 — X position
f3÷        floor divide the 0-based counter by 3
⁽       increment by 2
3*     multiply by 3
ž    insert it in the main canvas


# Python 3, 319 bytes

Hide a %9s into compressed string, then use time.strftime to get time, %-I to strip the leading zero.

import lzma,base64,time
lambda a:lzma.decompress(base64.b85decode('T>t=p0RR90|NsC0{{Rpd^C|@(1XTL^fu<KIrh0p%HYiiZbvoDPNw6<V^!O(Lz{boqzUBx6K?Tsnl5A-wX&%GXCq@<%4wDjJcoz5VNNSc<>}9i|2|i)oHsC6Kg@30<nrg{=G5%W0xn9J;m-hJXY%|G!|Limu^8')).decode()%[time.strftime('%-I:%M',time.gmtime()),a,'%d:%02d'%(a/60,a%60)][a and~(a<60)]


Try it online!

• Did this use Mr. XCoder's template? I'd like to know whether to flag the comment. Dec 3 '17 at 15:57
• @StephenLeppik Oh, I didn't notice that there was a template. Dec 3 '17 at 16:07

# PHP, 416 bytes

if(is_numeric($a=$argv[1])&&$a&&-1<$s=$a%60){$m=(int)($a==$s?'':$a/60);$s=$m||$s>9?substr("0$s",-2,2):$s;$e=$m?"$m:$s":"$s";}elseif(!$a){$e=date("g:i");}else{$e=date("g:i",strtotime($a));}$e=str_pad($e,9);eval(gzinflate(base64_decode('S03OyFdQUIqnBPBy1SiQAoCqkXQD+aQbUKOgkgqiYDqJcCVMJ5IQwgBi7K+BWa2AhMkywBCIjYDYmEwDQE6H4QHyggkQmwKx2dD1gjkQWwCx5QB7QYF8LxgAcXBJYlEJZV4gOy9gz8fIWQwXQAoDhJlkFQSUGoBRHhDheiQt6HwlawA=')));  More readable: if(is_numeric($a=$argv[1])&&$a&&-1<$s=$a%60){
$m=(int)($a==$s?'':$a/60);
$s=$m||$s>9?substr("0$s",-2,2):$s;$e=$m?"$m:$s":"$s";
}elseif(!$a){$e=date("g:i");
}else{
$e=date("g:i",strtotime($a));
}
$e=str_pad($e,9);
eval(gzinflate(base64_decode('S03OyFdQUIqnBPBy1SiQAoCqkXQD+aQbUKOgkgqiYDqJcCVMJ5IQwgBi7K+BWa2AhMkywBCIjYDYmEwDQE6H4QHyggkQmwKx2dD1gjkQWwCx5QB7QYF8LxgAcXBJYlEJZV4gOy9gz8fIWQwXQAoDhJlkFQSUGoBRHhDheiQt6HwlawA=')));


$e is placed within the zipped microwave which also includes the echo like this (the double space after the echo is to get a more optimal b64 encoded string, it saves a byte here): echo base64_encode(gzdeflate('echo "_____________________________________________________________ | | ___________ | | | |$e | |


## Batch, 833 bytes

@echo off
set t=%time%
set/ah=(%t:~,2%+11)%%12+1,s=%1+0,s+=s/60*40
if %s%==0 set s=%h%%t:~3,2%
set s=   %s%
set s=%s:~-4,2%:%s:~-2%
set s=%s:  :=   %
set u=_______
set p=
set "v=|    |
for %%l in (" %u%%u%%u%%u%%u%%u%%u%%u%_____" "|%p%%p%%p%%p% |  %u%____  |" "|%p%%p%%p%%p% | |   %s%   | |" "|     %u%%u%%u%%u%%u%     | |%u%____| |") do echo %%~l
call:c 1 2 3
call:c 4 5 6
call:c 7 8 9
for %%l in ("%v%%p%%p%%p% %v%|   |%p:~4%| |" "%v%%p%%p%%p% %v%| 0 | Start | |" "%v%%p%%p%%p% %v%|___|%u%| |" "%v%%p%%p%%p% %v% %u%____  |" "|    |%u%%u%%u%%u%%u%%v%|%p%| |" "|%p%%p%%p%%p% | |%p%| |" "|%p%%p%%p%%p% | |%u%____| |" "|%u%%u%%u%%u%%u%%u%___|%u%%u%_|") do echo %%~l
exit/b
:c
for %%l in ("%v%%p%%p%%p% %v%|   |   |   | |" "%v%%p%%p%%p% %v%| %1 | %2 | %3 | |" "%v%%p%%p%%p% %v%|___|___|___| |") do echo %%~l


# Python 2, 481 bytes

from datetime import*
def f(t,r=range):
d=datetime.utcnow();g=[[' ']*63 for _ in" "*21]
for i in r(1,62):
for j in[0,-1]+[3,-4]*(5<i<41)+[1,3,6,9,12,15,16,19]*(48<i<60):g[j][i]="_"
for i in r(1,21):
for j in[0,-1,46]+[5,41]*(3<i<18)+[48,60]*(1<i<20)*(i!=16)+[52]*(3<i<16)+[56]*(3<i<13):g[i][j]="|"
for i in r(10):g[i/3*3+5][i%3*4+50]=-~i%10
g[14][54:59]="Start";g[2][49:60]=(t and(t/60+":")*(t>59)+t%60.zfill(2)ord.hour+":"+d.minute.zfill(2)).center(11);return g


Try it online!

# C#, 701 bytes

Try it Online!

(a)=>{int j=0;Func<int,string>b=(c)=>new string(new[]{1,0,1,0,1,1,0,1,0,0,1,1}[j++]>0?'_':' ',c);string e="|    |                                   |    | |",f=e+"___|___|___| |";Func<int,string>g=h=>e+$" {h} | {h+1} | {h+2} | |";return$@" {b(61)}
|{b(45)}|  {b(11)}  |
|     {b(35)}     | |{b( 11)}| |
{e}   |   |   | |
{g(1)}
{f}
{e}   |   |   | |
{g(4)}
{f}
{e}   |   |   | |
{g(7)}
{f}
{e}   |       | |
{e} 0 | Start | |
{e}___|_______| |
|    |{b( 35)}|    |  ___________  |
|    |{b( 35)}|    | |           | |
|     {b(35)}     | |           | |
|     {b(35)}     | |___________| |
|{b(45)}|{b(15)}|";}
`