Is there a tag that can be used for an "operation golf" (for lack of a better phrase) challenge? Where the criteria is, for example, the number of operators and/or library function calls (e.g. cos or whatever) you use, rather than the character/byte count? (That's just an example, such a challenge would have much more clearly specified criteria.)


You're looking for . But be aware that challenges of this genre are very tricky to get right, because it's hard to define in an objective way, across all possible languages, what counts as a single operator (or token etc). And then there's the issue that many languages have some form of eval, so if the program contains too many tokens or operators, they'll just stuff it all in a string.

These challenges usually work best when you can design a simple toy-language for everyone to use, which doesn't have these issues (e.g. only allow basic maths operations). Here is a good example of that.

If you mean "least number of operator/function calls at runtime", the tag you're looking for is . The same caveats as above apply.

  • \$\begingroup\$ Ah, so my next question was going to be whether or not I can limit the set of acceptable languages in the criteria, but then I see your comment about the toy language. So I can specify a pseudo-language as long as I make it clear? Very nice. And excellent example. \$\endgroup\$ – Jason C Apr 6 '17 at 15:13
  • \$\begingroup\$ @JasonC If it's really simple (or mostly maths), it's fine if you make it a pseudo-language. If it gets a bit more complicated (or programmer-y, i.e. it has procedural constructs or something), it would be good if you provide a reference interpreter so it can be unambiguously determined whether answers are valid or not. \$\endgroup\$ – Martin Ender Apr 6 '17 at 15:15
  • \$\begingroup\$ Do you think there'd be any interest in getting the community involved in designed a sort of "common" language that can be (optionally) used in such challenges, in the form of a citable meta post (for community input and documentation) and a reference interpreter? I realize this is off-topic, but before I take the time to even bother proposing it, I want to get a sense of whether it's completely off-base or not. Sort of an "official language of PPCG". I've got a pretty good idea that I think would suit challenges with varying criteria (including the limited operation example) well. \$\endgroup\$ – Jason C Apr 6 '17 at 15:17
  • 1
    \$\begingroup\$ @JasonC Possibly. The same thing has been done for fastest-code challenges. \$\endgroup\$ – Martin Ender Apr 6 '17 at 15:19
  • \$\begingroup\$ Excellent precedent. That may be my mission this weekend. Thanks! \$\endgroup\$ – Jason C Apr 6 '17 at 15:20
  • 1
    \$\begingroup\$ @JasonC I'd love to help you. If you want, create a chat room, and invite me :) \$\endgroup\$ – Nathan Merrill Apr 6 '17 at 16:28
  • \$\begingroup\$ @NathanMerrill I'm not going to dig in right this moment but I will definitely ping you in the next few days! \$\endgroup\$ – Jason C Apr 6 '17 at 16:33

You must log in to answer this question.

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