1
\$\begingroup\$

I've only recently started getting involved on Code Golf, so excuse my ignorance, but is there a format for longest possible way to achieve a challenge request? Either by runtime or by code length. Some rules I thought of for this format after browsing loopholes:

For longest runtime:

  • Code must have at least a theoretical possibility of termination. An example of this would be Bozo Sort: Because it is based on (pseudo-) random probability, no matter how long it takes, it has a theoretical chance of running to completion.
  • Clock speed of the computer running the challenge must be taken into account somehow when calculating the score. Perhaps as a multiple of the actual runtime in milliseconds, or maybe OP should be responsible for timing answers on his machine if it's practical to do so.
  • Theoretical average-case performance of an answer must be used rather than specific runs with specific data unless otherwise specified, especially if the algorithm uses an RNG. Questions where this may affect the score should specify how to time the execution of an answer.

For longest length code:

  • All statements in the program must contribute specifically towards the completion of the challenge. Examples of invalid statements are ;, noop, var uselessVar;, a repeating chain of statements (e.g. .split('').join('')...)
  • To clarify the last point further, at no point in the program can a statement "undo" something that was done in another statement. This should hopefully be a given for this format.
  • No statements can be used to alias variables or functions, unless it can be demonstrated that this is necessary to the code while satisfying these other restrictions. For example, to avoid the common scoping issue in JavaScript, var self = this; is acceptable.
  • All function and variable names declared in the program count only as 1 byte / char / stroke.
  • All answers should be in natively written language of choice; importing a 3rd party library violates the restriction that "all statements in the program must contribute specifically towards the completion of the challenge". Note that this is different than importing a standard library, and in fact doing so is encouraged if a standard function exists from it which you need to complete a challenge.
  • Extraneous whitespace nor statement separators do not count towards the length. For example, in JavaScript if you have two statements like:

    var arr;
    arr = new Array();
    

    neither the ; after arr nor the newline are necessary to separate the statements, but at least one of them is. Because of this, the length of this snippet will be calculated after formatting it like this:

    var a;a=new Array()
    

    which is to say, all extraneous characters are removed (arr is shortened to a due to the 4th bullet point).

There may be more applicable restrictions but I hope this at least conveys the format I'm asking about. Does something like this exist, and if not, would it be a worthwhile addition to the list of question formats?

\$\endgroup\$
  • 2
    \$\begingroup\$ We have the code-bowling tag, but such questions are not usually well received. Regardless of the format, you can sandbox a challenge and get community feedback to make sure it fits in well. \$\endgroup\$ – Alex A. Sep 8 '15 at 22:56
  • \$\begingroup\$ Ah, that looks like what I'm looking for, and I can see why those questions are not well-received. The rules for code-bowling should be more well-defined than they are currently. \$\endgroup\$ – Patrick Roberts Sep 8 '15 at 23:01
  • 2
    \$\begingroup\$ And busy-beaver for longest runtime. \$\endgroup\$ – jimmy23013 Sep 9 '15 at 9:47

You must log in to answer this question.

Browse other questions tagged .