Fixed output challenges usually state that the program "must take no input". I usually interpret this as "The standard input is empty", but after thinking about this, there are actually several valid interpretations:
- The program has to ignore the standard input, that is, it should work regardless of what is given as input.
- The program has to work only when an empty stream is piped into the standard input.
- The program has to work without piping anything into it. It may block for user input, but can expect the input to be empty.
- The program has to work without piping anything into it and it must not block for user input.
There are probably even more interpretations. The last three are worth distinguishing: for instance, my own language Retina was until recently not able to prevent blocking for user input when nothing was piped in - so to really run it without any input one had to do
echo "" | ./Retina -s program.ret
I imagine there are other languages which have this limitation.
So what should the default meaning of "your program must take no input" be?
(There was a related discussion for languages which plainly incapable of executing any code at all if no input is given.)
echo "" | java -jar cjam.jar program.cjam
still work if""
was not an empty string? I don't think the question makes sense in general. \$\endgroup\$1
you'd probably need to start off with;
(but whether that's actually the case, depends on the specific program - something else in the program might already get rid of the input that's already on the stack). As a side note, the program only ever works for a finite input stream (the same would go for Retina). \$\endgroup\$