13
\$\begingroup\$

Sometimes I find myself wanting a hot dog (don't we all) and so I make one. Now to make a hot dog, it is very simple.

1) Put the hot dogs into boiling water

2) Wait for a certain amount of time (detailed below)

3) Eat the hot dog once the time has elapsed.

You may have noticed that I said

certain time (detailed below)

and so I will detail.

Many different brands have many different recommendations for how long we should cook the hot dogs, but I have found it best to cook them for exactly 4 minutes and 27 seconds (don't ask). I have tried many different timers, but have found that a program that continuously outputs is the best way to attract my attention.

YOUR TASK

You have to make a program that will output the message Not ready yet for exactly 4 minutes and 27 seconds. After this time has elasped, you should output Eat your hot dog until the end of time. Please don't take any input.

HOW TO WIN

You must write the shortest code in bytes to win because this is a

\$\endgroup\$
10
  • 2
    \$\begingroup\$ Very closely related. \$\endgroup\$ Commented Apr 5, 2017 at 16:37
  • 1
    \$\begingroup\$ Quite close to Legen… wait for it… also. \$\endgroup\$
    – manatwork
    Commented Apr 5, 2017 at 16:38
  • \$\begingroup\$ The only difference is that this challenge requires the program to wait for a specific amount of time \$\endgroup\$
    – user41805
    Commented Apr 5, 2017 at 16:40
  • 8
    \$\begingroup\$ Must we output "Not ready yet" continuously over and over again until the interval finishes (Not ready yet\nNot ready yet\n...) or can we just output it once and change the output once the 4m 27s is over? \$\endgroup\$
    – user41805
    Commented Apr 5, 2017 at 18:59
  • 1
    \$\begingroup\$ Oops, my answer has been reminding me to eat my hot dog for the last two days... \$\endgroup\$
    – Neil
    Commented Apr 8, 2017 at 9:46

28 Answers 28

20
\$\begingroup\$

Scratch, 93 78 bytes

image representation

Code:

when gf clicked
say[Not ready yet
wait until<(timer)>[267
say[Eat your hot dog

Generated by https://scratchblocks.github.io/, which seems to be the standard for Scratch scoring.

Fairly self explanatory. When the program starts, say "Not ready yet" until the timer (which is counted in seconds) is greater than 267. Then starts an infinite loop where it says Eat your hot dog.

It is continuous output, because the say block runs forever unless you say [] or say something else.

\$\endgroup\$
5
  • 7
    \$\begingroup\$ There is no need for the forever, saving 8 bytes. That takes it to 85 bytes. It is also shorter in Hñähñu (Mezquital Otomi), instead of English, by another 8 bytes (without the forever), taking it to just 77 bytes. \$\endgroup\$
    – Tim
    Commented Apr 6, 2017 at 1:05
  • \$\begingroup\$ scratchblocks.github.io/… \$\endgroup\$
    – Tim
    Commented Apr 6, 2017 at 1:21
  • \$\begingroup\$ @Tim thanks, but the green flag doesn't seem to work. \$\endgroup\$
    – Okx
    Commented Apr 6, 2017 at 6:53
  • \$\begingroup\$ Actually that comes from the official translation by the website, so it's a bug that it renders wrong. \$\endgroup\$
    – Tim
    Commented Apr 6, 2017 at 10:03
  • \$\begingroup\$ @Tim The green flag block probably hasn't been implemented yet (although the translation still translates it). Also, there is no Hñähñu language in official Scratch. \$\endgroup\$ Commented Apr 6, 2017 at 18:48
14
\$\begingroup\$

Bash + coreutils, 50

timeout 267 yes Not ready yet
yes Eat your hot dog

Explanation

Fairly self-explanatory I think, but just in case:

  • The yes coreutil continuously repeatedly outputs any parameters passed to it on the command line
  • The timeout coreutil takes a numeric timeout parameter followed by a command. The command is run, then killed after the specified timeout.
\$\endgroup\$
8
\$\begingroup\$

Operation Flashpoint scripting language, 67 bytes

#l
s="Not ready yet"
?_time>267:s="Eat your hot dog"
hint s
goto"l"

Save as "hotdog.sqs" (or whatever) in the mission folder and call with [] exec "hotdog.sqs".

Explanation:

#l                                  // Label for the "goto"
s="Not ready yet"
?_time>267:s="Eat your hot dog"     // "?:" means "if () then" in a script.
                                    // "_time" is a local variable that is automatically
                                    // created and updated in every script. Its value
                                    // is the time in seconds since the script started.

hint s                              // Outputs the text in a text box.

~.1                                 // Sleeps for a tenth of a second.
                                    // The script seems to work without sleeping too,
                                    // so I didn't include this in the golfed version.
                                    // Looping in a script without sleeping is always
                                    // a bad idea, though. It sometimes crashes the game.

goto"l"                             // Go back to the beginning of the loop.
                                    // This is the only way to create a loop if you don't 
                                    // want to halt the game (and the time calculation)
                                    // until the loop finishes.

I have tried many different timers, but have found that a program that continuously outputs is the best way to attract my attention.

This solution should be especially good with attracting your attention, since the hint command plays a clinging sound effect every time it's called, which sounds very annoying when the simultaneous sounds get clipped in a tight loop.

\$\endgroup\$
7
\$\begingroup\$

JavaScript ES6, 76 bytes

$=>setInterval("console.log(--_>0?`Not ready yet`:`Eat your hot dog`)",_=517)

Explanation

This prints something to the console every 517 milliseconds. At first, it prints 'Not ready yet' and decreases the counter. After 517 iterations (= 517 * 517 = 267289 ms), it starts printing 'Eat your hot dog'.

Test

f=
  $=>setInterval("console.log(--_>0?`Not ready yet`:`Eat your hot dog`)",_=517);
(setInterval("console.log('DONE NOW')",267000)&&f())();

\$\endgroup\$
4
  • \$\begingroup\$ can't you just do settimeout and save a byte? \$\endgroup\$ Commented Apr 7, 2017 at 0:06
  • \$\begingroup\$ setTimeout only executes the function once. The challenge is to continuously output a string, so setTimeout would be invalid. \$\endgroup\$
    – Luke
    Commented Apr 7, 2017 at 6:05
  • \$\begingroup\$ (--_? works instead of (--_>0? (-2) \$\endgroup\$
    – dandavis
    Commented Apr 7, 2017 at 6:27
  • \$\begingroup\$ Unfortunately, it doesn't _ will be decremented every time something is printed, so it will also go below zero. All negative integers are truthy, so those would print 'Not ready yet' as well (which is not what we want). \$\endgroup\$
    – Luke
    Commented Apr 7, 2017 at 11:09
7
\$\begingroup\$

Powershell, 85 71 59 bytes

1..276|%{Sleep 1;'Not ready yet'};for(){'Eat your hot dog'}

There's probably a much better way, so criticism welcome! This is my first golf attempt :)

EDIT Down a whole 14 bytes thanks to AdmBorkBork! And definitely a technique to remember!

EDIT 2 Another 12 bytes gone thanks to Matt. Not calling write twice also removed 2 spaces, very helpful!

\$\endgroup\$
2
  • 1
    \$\begingroup\$ Welcome to PPCG! Nice to see another PowerSheller around. An easy golf is to run a loop a fixed number of times 1..276|%{} instead of a for loop with an increment. Check out some other tips on that page, too! \$\endgroup\$ Commented Apr 5, 2017 at 20:54
  • \$\begingroup\$ Strings are sent to std out be default. No need to specify with the write-output cmdlet. \$\endgroup\$
    – Matt
    Commented Apr 6, 2017 at 16:05
7
\$\begingroup\$

GameMaker' scripting language variant used in Nuclear Throne Together mod, 68 bytes

t=0while 1{trace(t++<8010?"Not ready yet":"Eat your hot dog")wait 1}

Explanation

  • GML's parser is deliciously forgiving. Semicolons and parentheses are optional, and the compiler is not at all concerned about your spacing outside the basic rules (0while parses as 0,while and thus is ok)
  • Variables leak into the executing context unless declared via var (same as with JS).
  • GML variant used in NTT introduces a wait operator, which pushes the executing "micro-thread" to a list for the specified number of frames, resuming afterwards. Coroutines, basically.

    The game is clocked at 30fps, so 4m27s == 267s == 8010 frames.

  • trace() outputs the given string into the chat.

If you have the videogame+mod installed, you can save that as some test.mod.gml, and do /loadmod test to execute it, flooding the chat with "status reports":

screenshot

\$\endgroup\$
1
  • 3
    \$\begingroup\$ I am not exactly sure what is going on here, but I approve. \$\endgroup\$
    – user18932
    Commented Apr 7, 2017 at 2:27
3
\$\begingroup\$

Python 2, 92 bytes

from time import*
t=time()
while 1:print"Not ready yet"if time()-t<267else"Eat your hot dog"

Try it online!

\$\endgroup\$
2
  • 9
    \$\begingroup\$ while 1:print'ENaott yroeuard yh oyte td o g'[time()-t<267::2] for 90 bytes \$\endgroup\$
    – ovs
    Commented Apr 5, 2017 at 17:37
  • \$\begingroup\$ @ovs while 1:print['Eat your hot dog','Not ready yet'][time()-t<267] would also be 90 (while being clearer and not printing the extra white space). \$\endgroup\$ Commented Apr 12, 2017 at 22:47
3
\$\begingroup\$

TI-Basic, 75 bytes

For(A,1,267
Disp "Not ready yet
Wait 1
End
While 1
Disp "Eat your hot dog
End

Explanation

For(A,1,267             # 9 bytes, for 267 times...
Disp "Not ready yet     # 26 bytes, display message
Wait 1                  # 3 bytes, and wait one second
End                     # 2 bytes, ...end
While 1                 # 3 bytes, after that, continuously...
Disp "Eat your hot dog  # 31 bytes, output second message
End                     # 1 byte, ...end
\$\endgroup\$
2
\$\begingroup\$

C# 144 bytes

()=>{for(int i=0;;){var s="\nEat your hot dog";if(i<267e3){i++;s="\nNot ready yet";}System.Console.Write(s);System.Threading.Thread.Sleep(1);}};

Ungolfed full program:

class P
{
    static void Main()
    {
        System.Action a = () => 
            {
                for (int i = 0; ;)
                {
                    var s = "\nEat your hot dog";
                    if (i < 267e3)
                    {
                        i++;
                        s = "\nNot ready yet";
                    }
                    System.Console.Write(s);
                    System.Threading.Thread.Sleep(1);
                }
            };

        a();
    }
}

Unfortunately I could not use the ?:-operator as I have not found a way to stop incrementing i without the if.

\$\endgroup\$
3
  • \$\begingroup\$ Try something like if(i++<267e3) to save a few bytes. \$\endgroup\$
    – adrianmp
    Commented Apr 6, 2017 at 9:30
  • 1
    \$\begingroup\$ @adrianmp: That wouldn't work, as that would still increment i every millisecond. And once int.MaxValue is reached the program would either crash or start printing Not ready yet again. \$\endgroup\$
    – raznagul
    Commented Apr 6, 2017 at 9:34
  • \$\begingroup\$ I've managed to pull this off by greatly delaying the overflow (or even mitigating it at the cost of a few bytes). I've "borrowed" some ideas from your answer. Thanks! \$\endgroup\$
    – adrianmp
    Commented Apr 7, 2017 at 11:54
2
\$\begingroup\$

C#, 174 172 147 bytes

Saved 25 bytes by "borrowing" some ideas from raznagul's C# answer and merging them with the sum of first n numbers trick!

Saved 2 bytes by using the sum of first n numbers trick for a loss of precision of 185 milliseconds.

class P{static void Main(){for(int i=1;;){System.Console.WriteLine(i++<731?"Not ready yet":"Eat your hot dog");System.Threading.Thread.Sleep(i);}}}

Ungolfed program:

class P
{
    static void Main()
    {
        for (int i=1;;)
        {
            System.Console.WriteLine( i++ < 731 ? "Not ready yet" : "Eat your hot dog");
            System.Threading.Thread.Sleep(i);
        }
    }
}

Explanation:

Since the total time to wait is hardcoded at 267 seconds, one can consider this number as a telescopic sum of the first n natural numbers, n * (n + 1) / 2, which must equal 267000 milliseconds.

This is equivalent to n^2 + n - 534000 = 0.

By solving this second order equation, n1 = 730.2532073142067, n2 = -n1. Of course, only the positive solution is accepted and can be approximated as 730.

The total time can be calculated as 730 * (730 + 1) / 2 = 266815 milliseconds. The imprecision is 185 milliseconds, imperceptible to humans. The code will now make the main (and only) thread sleeps for 1 millisecond, 2 milliseconds and so on up to 730, so the total sleep period is ~267 seconds.

Update:

The program's logic can be simplified further - basically it needs to continuously display a message and wait a specified time until switching to the second message.

The message can be change by using a ternary operator to check the passing of the specified time (~267 seconds).

The timing aspect is controlled by using an increasing counter and pausing the execution thread.

However, since the counter variable continues increasing indefinitely without any conditions to check its value, one can expect an integer overflow at some point, when the message reverts to Not ready yet.

A condition can be added to detect and mitigate the issue by assigning a positive value greater than 730 when the overflow occurs - like i=i<1?731:i inside the for loop. Sadly, it comes at the cost of 11 additional bytes:

class P{static void Main(){for(int i=1;;i=i<1?731:i){System.Console.Write(i++<731?"\nNot ready yet":"\nEat your hot dog");System.Threading.Thread.Sleep(i);}}}

The key here is using the counter value in milliseconds to greatly delay the moment of overflow.

The time until overflow can be calculated according to the sum(1..n) formula, where n = the maximum 32-bit signed integer value in C# (and the .NET framework) or 2^31 - 1 = 2147483647:

2 147 483 647 * 2 147 483 648 / 2 = 2,305843008 x 10^18 milliseconds = 2,305843008 x 10^15 seconds = 26 687 997 779 days = ~73 067 755 years

After 73 million years, it might not matter if a glitch in the system appears - the hot dog, the hungry OP and maybe the human race itself are long gone.


Previous version (172 bytes):

namespace System{class P{static void Main(){for(int i=1;i<731;){Console.Write("\nNot ready yet");Threading.Thread.Sleep(i++);}for(;;)Console.Write("\nEat your hot dog");}}}

Ungolfed program:

namespace System
{
    class P
    {
        static void Main()
        {
            for (int i = 1; i < 731; )
            {
                Console.Write("\nNot ready yet");
                Threading.Thread.Sleep(i++);
            }
            for ( ; ; )
                Console.Write("\nEat your hot dog");
        }
    }
}

Previous version (174 bytes):

namespace System{class P{static void Main(){for(int i=0;i++<267e3;){Console.Write("\nNot ready yet");Threading.Thread.Sleep(1);}for(;;)Console.Write("\nEat your hot dog");}}}

Ungolfed program:

namespace System
{
    class P
    {
        static void Main()
        {
            for (int i=0; i++ < 267e3; )
            {
                Console.Write("\nNot ready yet");
                Threading.Thread.Sleep(1);
            }
            for ( ; ; )
                Console.Write("\nEat your hot dog");
        }
    }
}

Alternatively, the program may display Not ready yet only once, wait until the specified time is over and then output Eat your hot dog by overwriting the previous message while being quite a few bytes shorter:

C#, 145 bytes

namespace System{class P{static void Main(){Console.Write("Not ready yet");Threading.Thread.Sleep(267000);Console.Write("\rEat your hot dog");}}}

Ungolfed program:

namespace System
{
    class P
    {
        static void Main()
        {
            Console.Write("Not ready yet");
            Threading.Thread.Sleep(267000);
            Console.Write("\rEat your hot dog");
        }
    }
}
\$\endgroup\$
1
  • \$\begingroup\$ That's great. I'd give you +1, if I hadn't already. ;) \$\endgroup\$
    – raznagul
    Commented Apr 7, 2017 at 21:19
2
\$\begingroup\$

Ruby, 80 71 67 Bytes

Edit: Thanks to manatwork for shaving off 13 whole bytes

267.times{puts"Not ready yet"
sleep 1}
loop{puts"Eat your hot dog"}
\$\endgroup\$
5
  • \$\begingroup\$ Why not 267.times{…}? \$\endgroup\$
    – manatwork
    Commented Apr 7, 2017 at 7:38
  • \$\begingroup\$ Wow, thanks. I feel dumb now. \$\endgroup\$
    – BRFNGRNBWS
    Commented Apr 7, 2017 at 12:52
  • \$\begingroup\$ Looks like you are counting with CR/LF line separators. As Ruby allows LF only, we used to count that only. And there is no need for the line break after the {. That would result 67 bytes. \$\endgroup\$
    – manatwork
    Commented Apr 7, 2017 at 13:34
  • \$\begingroup\$ I'm a beginner at Ruby, and a total noob at code golfing, so thanks for all the help! \$\endgroup\$
    – BRFNGRNBWS
    Commented Apr 7, 2017 at 13:49
  • \$\begingroup\$ In case you missed it, there is a collection of Tips for golfing in Ruby to help beginners. \$\endgroup\$
    – manatwork
    Commented Apr 7, 2017 at 13:56
2
\$\begingroup\$

05AB1E, 43 29 28 bytes (Thanks to Adnan)

267F…€–Žä‡«ªw,}[“Eat€ž…ß‹·“,

Does not work online, since it times out. Offline it will work.

267F: Loop 267 times

…€–Žä‡«ª: First string with dictionary

w,: Wait one second and print

}[: End if loop and start infinite loop

“Eat€ž…ß‹·“: Second string with dictionary

,: Print

\$\endgroup\$
5
  • \$\begingroup\$ Thanks, my client saw that this code was short and works offline - now he wants me to write his website using this language. . . \$\endgroup\$ Commented Apr 6, 2017 at 8:51
  • \$\begingroup\$ It works online, but just not on the interpreter that is given online. You can see for yourself here \$\endgroup\$
    – P. Knops
    Commented Apr 6, 2017 at 8:59
  • \$\begingroup\$ I know. It was a joke :D. \$\endgroup\$ Commented Apr 6, 2017 at 8:59
  • 1
    \$\begingroup\$ It's best to just answer the normal way :D \$\endgroup\$
    – P. Knops
    Commented Apr 6, 2017 at 9:01
  • \$\begingroup\$ “NotŽä‡«“ can be replaced by …€–Žä‡«ª \$\endgroup\$
    – Adnan
    Commented Apr 6, 2017 at 13:25
2
\$\begingroup\$

Batch, 99 97 bytes

@for /l %%t in (1,1,267)do @echo Not ready yet&timeout>nul 1
:l
@echo Eat your hot dog
@goto l

Batch has no date arithmetic so as a simple 267 second timeout isn't permitted the best I can do is 267 one-second timeouts. Edit: Removed unnecessary /t.

\$\endgroup\$
1
\$\begingroup\$

Python, 115 bytes

My first time trying something like this. I am also a beginner so here it goes in Python 3 for 115 bytes:

import time
for i in range(267):
    time.sleep(1)
    print("Not ready yet")
while 1:
    print("Eat your hotdog")
\$\endgroup\$
3
  • 3
    \$\begingroup\$ Welcome to the site! The aim of code golf is to write the shortest code possible in your language. There are a few things that can be improved and it couldn't hurt to look at the current Python winner for some tips! \$\endgroup\$
    – user67196
    Commented Apr 6, 2017 at 3:16
  • \$\begingroup\$ Remove the time.sleep(1) - saves a few bytes \$\endgroup\$ Commented Apr 6, 2017 at 8:54
  • \$\begingroup\$ @praszyk, then the for will finish looping over range(267) much faster than 4 minutes 27 seconds and the solution becomes invalid. ☹ \$\endgroup\$
    – manatwork
    Commented Apr 6, 2017 at 9:02
1
\$\begingroup\$

JavaScript Blocks Editor for micro:bit, 90 Bytes

enter image description here

The code:

basic.showString("Not ready yet")
basic.pause(254000)
basic.showString("Eat your hot dog")

You can try it here.

Got inspired by the Scratch answer to solve the task with my micro:bit. The only Problem is that the pause-block starts after outputting the first string so i needed to reduce the pause by 13s.

Note: The old Microsoft Block Editor for micro:bit is shorter to create but produces more code so is in fact longer.

\$\endgroup\$
1
\$\begingroup\$

On the basis that the OP wants hotdogs continuously, until the end of time - which I understand from the phrase:

After this time has elasped, you should output Eat your hot dog until the end of time.

This is my answer:

C++, 187 188 224 167 bytes

Whitespace removed (167 bytes):

#include<stdio.h>
#include<windows.h>
int main(){for(;;){for(int x=0;x<267;x++){Sleep(1000);printf("Not ready yet");}Sleep(1000);printf("Eat your hot dog");}return 0;}

readable form (224 bytes):

#include <stdio.h>
#include <windows.h>

int main() {
  for( ; ; ){ 
    for(int x=0; x < 267; x++){
      Sleep(1000);
      printf("Not ready yet"); 
    }
    Sleep(1000);
    printf("Eat your hot dog");
  }
  return 0;
}

If, on the other hand, OP enjoys his hot dogs in moderation, then this is my answer:

Whitespace removed (158 bytes):

#include<stdio.h>
#include<windows.h>
int main(){for(int x=0;x<267;x++){Sleep(1000);printf("Not ready yet");}Sleep(1000);printf("Eat your hot dog");return 0;}

readable form (198 bytes):

#include <stdio.h>
#include <windows.h>

int main() {
  for(int x=0; x < 267; x++){
    Sleep(1000);
    printf("Not ready yet"); 
  }
  Sleep(1000);
  printf("Eat your hot dog");
  return 0;
}
\$\endgroup\$
7
  • \$\begingroup\$ What's delay? \$\endgroup\$
    – Quentin
    Commented Apr 6, 2017 at 12:12
  • \$\begingroup\$ OK that's an old function. Replaced with Sleep(1000) \$\endgroup\$
    – Tombas
    Commented Apr 6, 2017 at 12:17
  • \$\begingroup\$ You can get rid of a bunch of whitespace to save bytes. Also, I count 224 bytes, not 188. \$\endgroup\$
    – hyperneutrino
    Commented Apr 6, 2017 at 13:00
  • \$\begingroup\$ @HyperNeutrino you're right - I counted line endings but not leading whitespace. Edited accordingly (sorry I'm new at this!) \$\endgroup\$
    – Tombas
    Commented Apr 6, 2017 at 13:16
  • \$\begingroup\$ @Quentin delay() is a function that I hoped could be lifted straight from Arduino... turns out that I can't! It did exist back in the day as part of the dos.h library, I understand. \$\endgroup\$
    – Tombas
    Commented Apr 6, 2017 at 13:17
1
\$\begingroup\$

Excel VBA, 82 Bytes

Anonymous VBE immediates window function that takes no input and outputs whether or not you should eat your hot dog to cell [A1].

d=Now+#0:4:27#:Do:[A1]=IIf(Now<d,"Not ready yet","Eat your hot dog"):DoEvents:Loop
\$\endgroup\$
1
  • 1
    \$\begingroup\$ Interesting I didn't knew you can run the program directly from Immediate window \$\endgroup\$ Commented Apr 16, 2017 at 16:24
1
\$\begingroup\$

Excel VBA 122 94 bytes

Sub p()
e=Now+#0:4:27#
Do
[a1]=IIf(Now<e,"Not ready yet","Eat your hot dog")
Loop
End Sub

Thanks Taylor Scott

\$\endgroup\$
6
  • \$\begingroup\$ You can cut down this solution quite a bit, CDate("00:04:28") can be condensed to #0:4:27#, you can replace your While ... Wend loop with a Do .. Loop Loop and you can replace your if clause with an iif clause \$\endgroup\$ Commented Apr 16, 2017 at 15:40
  • \$\begingroup\$ @TaylorScott Yes thanks :) \$\endgroup\$ Commented Apr 16, 2017 at 15:42
  • 1
    \$\begingroup\$ @TaylorScott is there any alternative for msgbox ? \$\endgroup\$ Commented Apr 16, 2017 at 15:46
  • 1
    \$\begingroup\$ @TaylorScott also iif clause is not working with msgbox I am not sure why and #0:4:27# autoformats to a date not time you are free to edit the answer if you want \$\endgroup\$ Commented Apr 16, 2017 at 15:50
  • 1
    \$\begingroup\$ Actually because VBA does not have any STDIN or STDOUT, there are a lot of options available to you, such as the VBE immediates window and to cells in excel, you can see more about this at codegolf.stackexchange.com/a/107216/61846 \$\endgroup\$ Commented Apr 16, 2017 at 15:51
0
\$\begingroup\$

Javascript, 83 Bytes

d=Date.now()
while(1)alert(Date.now()-d<267000?"Not ready yet":"Eat your hot dog"))

Alertz for everyone!

\$\endgroup\$
9
  • 1
    \$\begingroup\$ You can change 267000 to 267e3 and save a byte. \$\endgroup\$
    – powelles
    Commented Apr 5, 2017 at 18:41
  • \$\begingroup\$ From the question: "You have to make a program". This is not a program or a function, but a snippet. \$\endgroup\$
    – Luke
    Commented Apr 5, 2017 at 18:47
  • 7
    \$\begingroup\$ This is a program. \$\endgroup\$
    – user58826
    Commented Apr 5, 2017 at 18:52
  • 1
    \$\begingroup\$ You can save a few bytes by using new Date in place of Date.now(), and another few by using for(d=new Date;;)alert... \$\endgroup\$ Commented Apr 5, 2017 at 21:25
  • 2
    \$\begingroup\$ alert() halts the program until the user closes and the challenge bans input \$\endgroup\$
    – dandavis
    Commented Apr 7, 2017 at 6:31
0
\$\begingroup\$

PERL, 76 bytes

$|++;
for(1..247){print'Not ready yet';sleep 1};print "Eat your hot dog";for(;;){}
\$\endgroup\$
1
  • 6
    \$\begingroup\$ I count 82 bytes. \$\endgroup\$
    – Oliver
    Commented Apr 6, 2017 at 3:37
0
\$\begingroup\$

PHP 88 bytes

<?$t=0;do{$t++;echo "Not ready yet";sleep(1);} while ($t<267);echo "Eat your hotdog";?>
\$\endgroup\$
4
  • 1
    \$\begingroup\$ “After this time has elasped, you should output Eat your hot dog until the end of time.” So you have to repeat the 2nd message too. That will add to its length, but fortunately there is place to shorten it: for($t=267;$t--;sleep(1))echo"Not ready yet";for(;;)echo"Eat your hotdog";. By the way, running code with php -r is accepted, so no need for the PHP tags (especially not the closing one, which is considered bad habit in that case: “The closing ?> tag MUST be omitted from files containing only PHP” – PSR-2). \$\endgroup\$
    – manatwork
    Commented Apr 6, 2017 at 7:31
  • 1
    \$\begingroup\$ @manatwork untested: for($t=267;;sleep(1))echo $t-->0?"Not ready yet":"Eat your hotdog"; \$\endgroup\$
    – diynevala
    Commented Apr 6, 2017 at 9:40
  • \$\begingroup\$ Interesting one, @diynevala. According to the documentation, “If PHP encounters a number beyond the bounds of the integer type, it will be interpreted as a float instead. Also, an operation which results in a number beyond the bounds of the integer type will return a float instead.” – Integer overflow, so that condition should work correctly until the end of time. \$\endgroup\$
    – manatwork
    Commented Apr 6, 2017 at 9:57
  • \$\begingroup\$ @manatwork Also sleeps for 1 second between outputs even after 267 seconds. \$\endgroup\$
    – diynevala
    Commented Apr 7, 2017 at 9:30
0
\$\begingroup\$

REXX, 82 bytes

do forever
if time(e)<267 then say 'Not ready yet'
else say 'Eat your hot dog'
end
\$\endgroup\$
0
\$\begingroup\$

Java 7, 152 bytes

void c(){for(long s=System.nanoTime(),e=s+(long)267e9;s<e;s=System.nanoTime())System.out.println("Not ready yet");System.out.print("Eat your hot dog");}

Explanation:

void c(){                                 // Method
  for(                                    //  Loop
      long s=System.nanoTime(),           //    Current time in nanoseconds as start
      e=s+(long)267e9;                    //    End time (267 seconds later)
      s<e;                                //    Loop as long as we haven't reached the end time
      s=System.nanoTime())                //    After every iteration get the new current time in nanoseconds
    System.out.println("Not ready yet");  //   Print "Not ready yet" as long as we loop
                                          //  End of loop (implicit / single-line body)
  System.out.print("Eat your hot dog");   //  Print "Eat your hot dog"
}                                         // End of method
\$\endgroup\$
0
\$\begingroup\$

PHP, 68 bytes

for($t=268;$t--;sleep(1))echo$t?"Not ready yet←":"Eat your hot dog";

continuous output; is ASCII 10 = LF. Run with -r.

one-time output, 50 bytes

Not ready yet<?sleep(267);echo"←Eat your hot dog";

where is ASCII 13 = CR. Save to file or use piping to run.

\$\endgroup\$
0
\$\begingroup\$

RBX.Lua, 69 bytes

for i=1,267 do print"Not ready yet"Wait(1)end;print"Eat your hot dog"

RBX.Lua is the language used on ROBLOX.com. It is a modified version of Lua 5.1 that features a built-in 'Wait' function. The above code is pretty self-explanatory, below is a more readable version:

for i = 1, 267 do
    print("Not ready yet");
    Wait(1);
end

print("Eat your hot dog");

The code outputs "Not ready yet" continuously into STDOUT, for 267 seconds (4 minutes 27 seconds) before outputting "Eat your hot dog".

\$\endgroup\$
0
\$\begingroup\$

C - 130 bytes

It could be slightly shorter (128bytes), but I thought it neater to overwrite "Not ready yet"

#include<stdio.h>
#include<unistd.h>
int main(){printf("Not ready yet");fflush(stdout);sleep(267);printf("\rEat your hot dog\n");}
\$\endgroup\$
1
  • \$\begingroup\$ Welcome on the site! You can omit #include<unistd.h> (it will emit a warning but still compile). Doing as you do (overwriting the previous message) is your right, but since the challenge doesn't really ask for it, I'd suggest not to do it. It would allow you to do int main(){puts("Not ready yet");sleep(267);puts("Eat your hot dog");} (with no includes, they aren't needed) - but no obligation to do it of course. \$\endgroup\$
    – Dada
    Commented Apr 7, 2017 at 11:52
-1
\$\begingroup\$

VBA,126 Bytes

sub hd()
Debug.print "Not ready Yet"
application.wait(now+timevalue(00:04:27))
Debug.print "Eat your hot dog"
end sub
\$\endgroup\$
1
  • 1
    \$\begingroup\$ Doesn't do what the challenge asked for. \$\endgroup\$ Commented Apr 7, 2017 at 8:26
-1
\$\begingroup\$

Python 2.7, 90 88 bytes

import time;exec"print'Not ready yet';time.sleep(1);"*267;while 1:print"Eat your hotdog"
\$\endgroup\$
1
  • \$\begingroup\$ I don't get why someone -1'd my answer. can some1 explain? :( \$\endgroup\$ Commented Jul 6, 2017 at 11:18