Tag Info

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.

24

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 ...

19

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. ...

19

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 ...

18

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 ...

17

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 ...

17

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 ...

15

If your function is syntactically valid without the import (or similar mechanism), then it's not necessary to include the bytes for the import in your byte count, even if the import is needed to construct objects of the type that your function expects. Explicitly referencing the imported thing requires the import being counted. Here are a few examples: ...

15

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 ...

14

Yes, it's perfectly valid The byte count of the solution would be the sum of the byte counts of any files involved, plus the length of any special invocations needed. For your first example, you have this: //run.rb puts %x(node a) //a console.log(x=>x) This would be invoked as ruby run.rb, and would be in the language Ruby + nodeJS, with a byte count of ...

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 ...

13

Score is the length of the import plus the length of the function name This seems to be the standard around here. If there exists a built-in function (we'll call it foo) that solves the task, and built-ins are not forbidden, then, for a challenge that accepts functions and not just full programs, the solution would be: Python, 3 bytes foo Similarly, if foo ...

13

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 ...

12

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 ...

12

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 ...

12

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 ...

12

Yes, it is valid Consider C. In order to run a C program, it is first passed through a compiler (like gcc or clang), then a linker (like ld or gold), and then the resulting executable is run. We have no problem with this (but we require the compiler to be specified, since different compilers implement the language differently, and thus by our rules they ...

12

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

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.

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

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 ...

11

The length is the size of the save file Unless there is another mechanism that can be used to reliably and consistently import a "program", the save file is the obvious choice. Yes, that means your score will probably be much higher than other languages. No, there's nothing wrong with that - competition within languages, remember? As commented, you ...

11

They're evidently part of the program, and they're important information so they should be counted. That said, I'd probably count them as 3 bytes (not 5 as would normally the case when you have to add a space, a hyphen and your three characters to the command-line invocation) since the "standard invocation" always includes those three bytes, it's just not ...

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

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

The length in bytes of a program is the number of bytes in its source file. If this means that Hello World is 600000 bytes, that's a problem with the language, not with the scoring system. If the language has lots of boilerplate, that's a problem with the language, not with the scoring system. Although the above is really all that needs to be said (and has ...

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