Hot answers tagged

26

There is now an MC Standard for bytecount. With the 1.10 update, they introduced a block called the "structure block", which creates a .nbt file representing a structure in its entirety that can be measured in bytes. As this is a Minecraft standard for converting builds into bytes, this should be our standard as well.


23

Count code size before autoformatting Rationale: You can type or paste unformatted code into the interpreter, hit run, and it works. The fact that the interpreter adds whitespace or expands shortcuts is irrelevant. If you typed 4 bytes, the size of your program is 4 bytes. Rationale 2: Geobits points out that many IDEs have an option to turn autoformatting ...


18

Score the number of bytes by the number of bytes This really seems pretty straightforward. If your program is run as $ mylang somefile then the score of your answer should be the output of $ wc -c somefile that is, the number of bytes in the file. If your language requires a command line switch to read raw bytes (RGBRGBRGB...), count that as an extra ...


17

Bytes ≡ Functionality I love Minecraft! Here's my two cents: Redstone-related items (i.e. items that interact with redstone) should be each 1 byte, except for: Command blocks, whose byte count should be 1 + length of inner code (Or 2 + length of inner code, if you are using version 1.9 or above, as this version adds an orientation to command blocks. ...


17

What should we do to prevent this type of shenanigan? Firstly, we should all solemnly commit to downvoting every answer we see in a language which is deliberately designed to try to exploit PPCG-specific loopholes. This kind of rules-lawyering funny-at-most-once loophole-seeking is bad sportsmanship and detrimental to the site. Secondly, I think that a ...


16

The answer's score is the source code's size Unless you can store your program somehow by using only 3 bits, you cannot claim a size of ⅜ bytes. That's the only rule that makes sense in the long run, since claiming scores that cannot actually be achieved by any implementation will inevitably lead to endless discussion about the scores of post X and language ...


15

Number of bytes in the image file We should stop making up new scoring schemes for programming languages, which only serves to make things more difficult. Code golf contests are scored in bytes, so that's what matters. Everything else is artifical and prone to not take all details into account. For example, scoring Piet submissions just by the number of ...


14

Jelly uses its own code page and the interpreter is capable of reading files encoded in this code page. Hence, it's actually possible to feed a working file of the claimed size to the interpreter and therefore the byte count is completely legitimate. Here is the relevant meta post which says that answers can use any encoding of their choice, as long as it ...


13

perl -e seems to be accepted without character penalty, so php -r should be OK as well. php -R is the equivalent to perl -ne, so php -R scriptname.php is a syntax error. php -f file, php -F file and plain php file all execute file, but none of them removes the need for PHP tags. In php -R code or php -F file, the flag should be counted as one byte, just ...


12

We already have a consensus that functions have to be reusable arbitrarily often. While that consensus arose in the context of side effects (such as changing global variables in a way that prevents the function from working more than once), I think we should apply it to this situation as well. 1+_* is not a function. Yes, it operates on the top of the ...


11

Can we come up with some standard rules for when two languages are considered different enough for the purposes of these challenges? I seriously doubt it. Whether, e.g., C and C++ should count as different languages depends on the other winning criteria. For polyglot, C and C++ are probably not different enough to count as two languages. Writing code that ...


11

I´m gonna propose some rules on counting Bytes in LabVIEW code, so tell me what you think. As Bytes are not really what LabVIEW does they were renamed to LabVIEW Primitives. wires: each wire is 1 LabVIEW Primitive, splitting a wire makes it 2 LabVIEW Primitive and so on Constants: strings are 1 LabVIEW Primitive per character, bools are 1 LabVIEW Primitive,...


11

On PPCG, languages are defined by their implementation. This includes any configuration files. Therefore, if you edit your local configuration files, you are essentially creating a new unpublished implementation of an existing language. Now, if you were to significantly edit your configuration files, and publish them somewhere, you have essentially created a ...


11

Number of codels in the image All codels in the image will be counted. This includes codels that are never visited, and black and white codels.


11

Your score is the number of bytes in your code in your language's encoding This is how it works with every other language on PPCG, and there's no need to make an exception. In Java, this is a valid solution to "Hello, World!" (posted here): class H{public static void main(String[]a){System.out.print("Hello, World!");}} There's no rule that says ...


11

I haven't thought through all of the issues and arrived at a balance of pros and cons, but there is one con which comes to mind immediately and should be included in the discussion. This would affect more than just scoring in code-golf Treating different implementations of the same specification as different languages already has consequences which IMO are ...


11

In my dream world, I would rather have code challenges generate a code that's actually useful in the real world, a code that makes its way to be an idiom, to be used in real world projects, and put in a language's standard library. The first and foremost problem with this is that real-world solutions require real-world problems, which usually aren't a good ...


11

First of all, we appreciate the effort. I have some concerns, though: I'm not sure that having the snippet hosted externally and using an iframe is a good idea. The reason is that having the code be a copy/paste snippet allows it to work without adding a dependency on an external site that may or may not continue to be maintained. A possible mitigation or ...


10

Most code-golf questions clearly include the winning criteria, and one of those is usually “the shortest code in bytes wins”. I don’t believe there are any restrictions on your asking a code-golf question with a slightly different winning criterion: “The shortest code as measured by method X wins.” Go ahead and do that. If people like it, they might imitate ...


10

As mentioned here, running programs via commands such as php -r "code here" is acceptable without penalty. Since <? and <?php are both unneeded (and in fact not allowed) when using php -r, it follows that neither tags are required.


10

Feature request: Column rearrangement In my opinion, the per-language results should be on the left since we emphasize competition within each language. It would simply be a swapping of the current left and right columns.


10

This should be left up to the question writer Each question has its own specific situation, so there is no formula to fit all cases. The other issue is that many posters may not be aware of this meta post. I'm not against having defaults, but it can also be odd for a new user to suddenly hear that rule X from meta post Y applies to their challenge. I ...


10

As Martin already explained, Jelly uses a custom code page that is incompatible with ASCII and UTF-8. This isn't a made-up way of counting bytes, but the Jelly interpreter can take the source code (and input/output, if desired) using this code page. This is actually the default for the official interpreter, which requires the u flag to process UTF-8 encoded ...


Only top voted, non community-wiki answers of a minimum length are eligible