Post History
On my challenge Looping Counter there are several entries like this which contains a function which needs to be called with the right parameters to give the correct output. In this particular case,...
#1: Initial revision
Under which condition is a function that takes arguments other than those specified by the challenge by itself a valid solution to a challenge?
On my challenge [Looping Counter](https://codegolf.codidact.com/posts/286280) there are several entries like [this](https://codegolf.codidact.com/posts/286280/286339#answer-286339) which contains a function which needs to be called with the right parameters to give the correct output. In this particular case, you get the desired output if and only if the function is called as `f(3,2)`; any other call gives a wrong result. The linked TIO code contains that call, but only in the footer part that is not counted to the solution. I consider that as invalid, as the code as is does not contain all the information needed to generate the intended output. If it is to be considered a valid solution,the question is how much can we omit without making it an invalid solution. Because clearly we would not want the following “solution” to the task “output the first 100 decimals of pi”: ``` f(char*s){puts(s);} ``` called from non-counted code that passes a string containing the first 100 decimals to the function. I think we need a general rule to decide if such a submission is valid or not. Note that there are several such solutions already to this challenge; I'd not be surprised if such solutions are sent to other challenges as well. So my question is: > Under which condition is a function that takes arguments other than those specified by the challenge by itself a valid solution to a challenge? My preferred solution would be that a function is a valid solution to a challenge if and only if it can be called with no more than the specified input of the task (which in this case would be, none at all). That is, in the answer linked above, the function as is does not solve the problem, but giving the arguments default values of `3` and `2` (so that it can be called as `f()` instead of `f(3,2)`) would make it a valid solution.