Golf a Compute interpreter
05AB1E, 16 15 14 13 bytes
Code:
[Ig>#w’
D€µ.
Explanation:
[ # Starts an infinite loop
I # Input string
g> # Length + 1
# # If equal to 1, break out of the loop
w # Wait 1 second
This part is equivalent to "\n\nDone."
:
’ # Push "\n\nDone." on top of the stack
D€µ. # The compressed string is ended implicitly
# Implicit, print top of the stack
Try it online!
Uses CP-1252 encoding.
JavaScript Shell REPL, 38 bytes
As a function that accepts the program as a string argument and returns the result:
s=>sleep(s.split`
`.length)||`
Done.`
29 bytes if the function can accept its input in the form of an array of lines, or if it should sleep 1 second per character:
s=>sleep(s.length)||`
Done.`
34 bytes if it should also be more like a program and explicitly print Done:
s=>sleep(s.length)||print`
Done.`
This works for me in the standalone Spidermonkey interpreter.
Javascript ES6, 46 45 bytes
a=>setTimeout(x=>alert`
Done.`,a.length*1e3)
Thanks to ӍѲꝆΛҐӍΛПҒЦꝆ for saving one byte
Assumes an array as input.
As both ӍѲꝆΛҐӍΛПҒЦꝆ and edc65 have pointed out you can write the following, but it won't save any bytes:
a=>setTimeout("alert`\n\nDone`",a.length*1e3)