Programming Puzzles & Code Golf Stack Exchange is a question and answer site for programming puzzle enthusiasts and code golfers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top


Compute is a esoteric joke language.

From the esolangs entry:

Compute has no required syntax and has the power to solve any and all problems. It is smart enough to interpret any human language (English, Spanish, Latin, etc), any programming language (C++, Java, brainfuck, etc), or any kind of data you can think of. The only downfall is that there is absolutely no I/O.

Some example programs

Hello World

A basic Hello World program

What is love?

Determines was love is (baby don't hurt me).

When will we ever graduate?

Determines the exact date of this site to get out of beta.

The Challenge

Your task is to write a full Compute interpreter. This sounds pretty hard, but keep in mind that Compute has absolutly no I/O. So your interpreter will just sleep one second for every line in the input program and output \n\nDone. after this (this is the only exception to the no I/O thing).

You can find the official interpreter at the bottom of this site.
Note that the official interpreter pauses one second for every character in the given source code. To avoid long waiting times while testing your interpreter with meaningful questions we stay with lines in this challenge.


  • The input might contain multiple lines seperated by a \n. There will always be at least one line.
  • Unlike the official implementation you don't have to take a file as input. You can take the Compute program in any form of input you want.
  • The only output allowed is \n\nDone.. A trailing newline is allowed.
  • Function or full program allowed.
  • Default rules for input/output.
  • Standard loopholes apply.
  • This is , so lowest byte-count wins. Tiebreaker is earlier submission.
share|improve this question
Inevitably reminded me of this – Luis Mendo Feb 15 at 17:33
Well, we don't need a program to tell us when we're going to graduate. We already know that it's the 26th. – Doorknob Feb 15 at 17:40
@Doorknob, of what century? – msh210 Feb 15 at 17:42
@DenkerAffe I think you should make it clear that the challenge does not exactly match the language. – Pietu1998 Feb 15 at 17:55
@msh210, no, that is the century. – Peter Taylor Feb 15 at 19:00

11 Answers 11

up vote 5 down vote accepted

05AB1E, 16 15 14 13 bytes





[        # 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.

share|improve this answer

JavaScript Shell REPL, 38 bytes

As a function that accepts the program as a string argument and returns the result:



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:



34 bytes if it should also be more like a program and explicitly print Done:



This works for me in the standalone Spidermonkey interpreter.

share|improve this answer

Javascript ES6, 46 45 bytes



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:

share|improve this answer
1e3 is better than 10e2. – Mama Fun Roll Feb 15 at 19:24
Also, convert the arrow function to a string. See – Mama Fun Roll Feb 15 at 19:27
@ӍѲꝆΛҐӍΛПҒЦꝆ I'm not sure that would work. Since he already has a template string, you would need to escape it – Cyoce Feb 15 at 19:47
@ӍѲꝆΛҐӍΛПҒЦꝆ 1e3 is better than 10e2 can't believe i missed that . – andlrc Feb 15 at 20:28
@edc65 You are not the first to talk about it, ӍѲꝆΛҐӍΛПҒЦꝆ also mentioned it. :-) – andlrc Feb 22 at 19:26

Pyth, 15 14 bytes


(You can try it online, but there's really no point in doing so.)

share|improve this answer
You are missing the period after Done (which is pretty funny since you told someone the same on another answer) :P – DenkerAffe Feb 15 at 18:00
@DenkerAffe Thanks. (Byte count was correct, though.) – Pietu1998 Feb 15 at 18:01
@muddyfish Thats what the challenge says. The official interpreter goes char-wise, but I changed it to lines to avoid waiting times. – DenkerAffe Feb 15 at 18:07
@DenkerAffe Ok now our entries our exactly the same. Whos to keep? I'm going to assume Pietu1998 because they were correct first – muddyfish Feb 15 at 18:08
Is b necessary? – busukxuan Feb 15 at 20:45

Oration, 117 bytes

I need time!
To iterate, input().
Now sleep(1).
Capture Done.
Carry on!

Let's explain this. First, this transpiles to:

import time
while input():

Still confused? Let's put it like this:

I need time!

Imports the module time.

To iterate, input().

This is a while loop whose condition is input().


Our program needs to breathe now, and inhale, whilst less healthy, is golfier.

Now sleep(1).

Now take the most recent module imported and appends .sleep(1) to it.


Let's exit the while loop.


Prints two newlines.


Begins capturing a string.

Capture Done.

Adds Done. to the captured string.

Carry on!

Finishes capturing string.

share|improve this answer
Looks like a fun language. Would you add a link to an interpreter + docs? – DenkerAffe Feb 15 at 21:24
@DenkerAffe The docs and interpreter can both be found in the heading I just edited in. – Cᴏɴᴏʀ O'Bʀɪᴇɴ Feb 15 at 21:25
@Conor Thanks, gonna have a look at it. :) – DenkerAffe Feb 15 at 21:30

Bash + coreutils, 28

sleep `wc -l`
echo "


Sleeps 1 second for every line. Use wc -c instead for every byte, or wc -m instead for every character.

share|improve this answer
Shouldn't there be an extra newline? – immibis Feb 16 at 8:35
@immibis Yes - you're right - fixed. – Digital Trauma Feb 16 at 17:12

Perl, 21 + 1 = 22 bytes

sleep 1}{$_="\n\nDone."

Requires the -p flag:

$ perl -pe'sleep 1}{$_="\n\nDone."' <<< $'a\nb\nc'

share|improve this answer

Python 3, 58 bytes

import time
while input():time.sleep(1)
share|improve this answer
Just wanna point this out, it would be 2 Bytes shorter in python 2, print"\n\nDone" – Random Guy Feb 15 at 23:44
Oh yeah, I forgot... Sorry. – Random Guy Feb 15 at 23:46

MATL, 17 bytes


A trailing empty line (followed by newline) is used to mark end of input. This is needed in MATL because input is interactive and each input ends with a newline.

Try it online!

10c           % push newline character
'Done.'       % push string
`             % do...while
  j           % input string
  t           % duplicate
  ?           % if non-empty
    1Y.       % pause for 1 second
              % loop condition is the current string. If non-empty: next iteration
              % If empty: exit loop and print stack contents. There are two strings
              % and a newline is printed after each, so the desired output is obtained
share|improve this answer
Are you missing the period after Done? – Pietu1998 Feb 15 at 17:52
@Pietu1998 Whoops. Corrected. Thanks! – Luis Mendo Feb 15 at 17:54

Ruby, 32 bytes

$<.map{sleep 1}

Reads from stdin.

share|improve this answer

Tellurium, 19 bytes


This is pretty much an infinite loop that gets input (i), waits for one second (¨) and prints two newlines followed by Done (µ´´Done~^)

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.