Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
Community Proposals
Community Proposals
tag:snake search within a tag
answers:0 unanswered questions
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
votes:4 posts with 4+ votes
created:<1w created < 1 week ago
post_type:xxxx type of post
Search help
Notifications
Mark all as read See all your notifications »
Meta

Post History

62%
+3 −1
Meta 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 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 answer  ·  posted 2y ago by celtschk‭  ·  last activity 2y ago by Quintec‭

Question discussion rules
#1: Initial revision by user avatar celtschk‭ · 2022-05-01T17:52:34Z (over 2 years ago)
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.