3
\$\begingroup\$

Should we define rules on how input can be fed into programs? This question on SO allowed for any input method, which resulted in answers which ripped off the question by doing the computation in macros for example. We should aim to prevent this abuse.

\$\endgroup\$
4
  • \$\begingroup\$ This is tricky. Normally I'd say, programs should use standard input and standard output, but, there are languages that don't have such concepts, and we shouldn't exclude those languages. \$\endgroup\$ Commented Jan 27, 2011 at 21:30
  • \$\begingroup\$ Did that special languages have some advantages because of it and did they lead? I think we should make a question (maybe CW) here at meta specially for that languages and provide link into FAQ. \$\endgroup\$
    – Nakilon
    Commented Jan 27, 2011 at 22:53
  • \$\begingroup\$ @Chris: What question used in code golf doesn't have those concepts? (Ok, I've seen one solution in LabView once, but those are probably quite rare.) As far as convenience and needed characters go my language of choice is rather poor when reading standard input, though. But any input method will make some languages better and others worse, I guess. \$\endgroup\$
    – Joey
    Commented Jan 27, 2011 at 23:06
  • 1
    \$\begingroup\$ Related question: meta.codegolf.stackexchange.com/questions/40/… \$\endgroup\$
    – Nakilon
    Commented Jan 28, 2011 at 1:57

2 Answers 2

5
\$\begingroup\$

I think we should leave the decision up to the particular CodeGolf... BUT, we should ask that questions are clear on the issue.

Seems to me that there are two major types of CodeGolf: Those that want complete working programs that match some input/output criteria; and those that want a function that computes the result.

In the first case, we should ask that the input/output formatting be well specified (it can still admit variation, but exactly how much variation should be clear.) Further, such CodeGolfs should be free to spec that the input is from stdin, or from a file, or from command line. Just so long as it is clear.

In the second case, usually the input/output to the function is meant to be "whatever is natural in the language". This can lead to some abuse, so I imagine that these CodeGolfs have some amount of leeway on the judging.

Personally, I much prefer the first kind, but I see no reason to enforce that as the only style. Some CodeGolfs want a program to meet

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

The standard should be standard input and standard ouput (hey, they're standard!), unless the question explicit states something else.

The SO question you linked to states clearly that the method of input can be anything:

How to take the input totally depends on you.

Given this, I wouldn't call it an abuse.

Some languages, like JavaScript, don't have the concept of standard input/output. We shouldn't forbid them. Any method that is a common pratice for that language (like alert in JavaScript) should be acceptable.

\$\endgroup\$

Not the answer you're looking for? Browse other questions tagged .