Today I corrected someone who thought that scoring by counting the number of calls to a given function at runtime is . Said person pointed me at a quote from the tag wiki:

Atomic code golf asks you to solve a task using only a limited set of operations, with as few of these operations as possible.

It is genuinely ambiguous.

The previous version, with a detailed scoring system, was probably too prescriptive; and I can understand if the author of the current version deliberately avoided the word token because of previous meta discussion about atomic-code-golf or because it's too restrictive for scoring questions. But if it can easily be understood to be talking about algorithmic complexity rather than source code, the current wording needs revision, and it seems like a good idea to sandbox the text here.

Therefore please post proposed edits (or rewrites) here, and let's see whether we can find a way of phrasing it which avoids all of the traps mentioned above.

  • \$\begingroup\$ It took me a couple times through the question to understand it, so a clarifying point: the main ambiguity that (seems to me) to need fixing is the difference between atomic-code-golf and fastest-algorithm, i.e. that atomic code golf is like code golf but measured in "operations" rather than bytes. In other words, the description should somehow indicate "as few of these operations in source code as possible" rather than "as few of these operations executed as possible" \$\endgroup\$ Commented Jul 18, 2018 at 16:05
  • 1
    \$\begingroup\$ @KamilDrakari, yes, roughly speaking. For situations where source code exists (as opposed to logic gates) it's most intuitive to think in terms of counting "tokens", but that terminology has problems (see linked question). \$\endgroup\$ Commented Jul 18, 2018 at 16:40

2 Answers 2


Here is another proposal to rip apart:

is similar to in that answers aim to minimise code size, but differs in that the size is counted in some "atom" other than bytes or characters.

For example, a question might ask for an implementation of a given logical function using any two-input logic gates, each scored equally; or it might allow only NOT gates for a score of 1 each and AND gates for a score of 2 each.

The original intention of this challenge type was to level the playing field between golfing languages and industrial languages by counting tokens in the source code; making, for example, C#'s .Length score only one more than GolfScript's equivalent ,. However, scoring code by tokens runs into problems of (a) defining "token" unambiguously for some languages; and (b) abuse of encoding programs into string or big integer literals. This challenge type works best for challenges which specify a single well-defined language and an unambiguous way of counting its atoms.

See also:

  • \$\begingroup\$ Reiterating my last comment. If we want the wording "works best for", than I would like to see an example that does in fact work without restricting to a specific domain included in the body. \$\endgroup\$
    – Wheat Wizard Mod
    Commented Jul 21, 2018 at 6:43
  • \$\begingroup\$ @WW, absence of proof is not proof of absence. I can justify the statement that it works best by pointing to historical problems, but I can't justify the statement that there is no set of more than one language (or suitable restricted subsets thereof) for which it works. There might e.g. be interesting challenges counting lines of code in 2D languages (although the actual question would have to specify it better than that). \$\endgroup\$ Commented Jul 21, 2018 at 8:05
  • \$\begingroup\$ Since this will mostly be read by people looking for guidance on the tag I think that should then be made clear in the wording. "Works best" seems like a much weaker claim than the claim we perhaps ought to be making. Perhaps something like "This challenge has historically worked for challenges which specify a single well-defined language and an unambiguous way of counting its atoms. But it may be possible that it could work for small sets of languages." That way it is clear the intention. \$\endgroup\$
    – Wheat Wizard Mod
    Commented Jul 21, 2018 at 8:12
  • \$\begingroup\$ @JonathanFrech, the first part of that paragraph is intended to give context for the second part, and I think that connection would be lost if a break is introduced. \$\endgroup\$ Commented Nov 26, 2018 at 15:22

My proposed rewrite below.

asks you to write a program with a score as small as you can.

The source code is divided into parts (often called "token", but it may be different, for example "logic gate", "node"). Each part has a score defined by the challenge. The score of the program is the sum of the scores of its parts.

is a special case of (where each byte is 1 token, and each token scores 1 point); and is a special case of .

Note for challenge-writers:

  • A challenge can be unambiguously defined when submissions are restricted to a single simple language/submission format (for example: a graph, logic gates), where it's possible to list all possible tokens and score them. Be careful to say exactly what each operation in your language does: for example, modulus works differently with negative numbers in different languages. Ideally, you could provider an interpreter for the language.
  • The tokenization rules must be objective. That is, it must be possible to write a program that tokenizes the program and score the programs objectively.
  • \$\begingroup\$ I'd be in favor of replacing works best with works at all until I see a counter example. But maybe that's just me. \$\endgroup\$
    – Wheat Wizard Mod
    Commented Jul 19, 2018 at 3:55
  • \$\begingroup\$ I was being a bit sassy, but yeah I like the new wording. \$\endgroup\$
    – Wheat Wizard Mod
    Commented Jul 19, 2018 at 4:03
  • \$\begingroup\$ Can you change: where each byte is 1 token, and each token scores 1 point \$\endgroup\$ Commented Jul 19, 2018 at 19:09
  • \$\begingroup\$ I'd also change The program is divided to The source code is divided to make it clear that we are operating on the source code. \$\endgroup\$ Commented Jul 19, 2018 at 19:13
  • \$\begingroup\$ @NathanMerrill What's the difference between "each token is 1 byte" and "each byte is 1 token"? I don't understand. \$\endgroup\$
    Commented Jul 20, 2018 at 4:24
  • \$\begingroup\$ @user202729 The difference is that we aren't counting the tokens, and then calculating the bytes. We are counting the bytes, and then calculating the tokens. I think for this challenge to be objective there has to be some form of source code that we operate on. That source code could be a listing of logic gates, or a graph. \$\endgroup\$ Commented Jul 20, 2018 at 12:38
  • \$\begingroup\$ Thanks for your thoughtful contribution. Things I particularly like about this proposal: relating atomic-code-golf to code-golf; being explicit about tokenisation being objective. Things I don't like: talking about "special cases" suggests that anything tagged code-golf could also be tagged atomic-code-golf and code-challenge, which is not the case; the wording around languages suggests that atomic-code-golf is inherently for single-language challenges, which I don't think is necessarily the case in theory (although certainly easier in practice). \$\endgroup\$ Commented Jul 20, 2018 at 22:22
  • \$\begingroup\$ @NathanMerrill I was not talking about the meaning, but the terminology. "logic gates" are usually not called "code"; even if it's converted into text format. Probably "submission"? \$\endgroup\$
    Commented Jul 21, 2018 at 13:54
  • \$\begingroup\$ @PeterTaylor (1) I see, but I'm not sure about how to express that. "Although a [code-golf] challenge is an [atomic-code-golf] challenge, you should still tag it with [code-golf] because it's more specific"? (2) I just say that it works for single-language, that doesn't imply that it must fail for multiple-language. According to WW's last request I changed "works best" to "can be unambiguously defined". Is that what you mean? \$\endgroup\$
    Commented Jul 21, 2018 at 13:59

You must log in to answer this question.

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