57
\$\begingroup\$

Challenge:

The concept is simple enough: write a full program to output its own code golf score!

Output should only be the byte count of your program and a trailing bytes.

BUT WAIT..... there is one restriction:

  • Your source code can not include any of the digits from your byte count
  • So if your score is 186 bytes, your program can not contain the characters 1 , 6 , or 8

Example Output:

315 bytes
27 Bytes
49 BYTES

Additional Rules:

  • Unnecessary characters, spaces, and newlines are forbidden in the source code, however trailing spaces and newlines are perfectly acceptable in output
  • There should be a single space between the number and bytes in the output
  • Letters are case insensitive
  • No self inspection or reading the source code
  • standard loopholes are disallowed

  • this is , so

Shortest code in bytes wins!

\$\endgroup\$
  • 6
    \$\begingroup\$ Does this need the quine tag, or may the code self-inspect? \$\endgroup\$ – Adám Mar 29 '18 at 15:59
  • 3
    \$\begingroup\$ @Dat, given the formatting of the word bytes I suspect the intention is that the count should include the bytes it takes to print the text: bytes \$\endgroup\$ – Jeff Schaller Mar 29 '18 at 16:16
  • 2
    \$\begingroup\$ Are leading spaces in output acceptable? \$\endgroup\$ – rafa11111 Mar 29 '18 at 17:43
  • 3
    \$\begingroup\$ If my code is 1 byte long, should I output 1 bytes or 1 byte? (keep in mind there are already 41 answers, although I don't think any are affected) \$\endgroup\$ – Erik the Outgolfer Mar 29 '18 at 18:07
  • 1
    \$\begingroup\$ @JoKing well I didn’t address casing in the rules, but if somehow using capital letters makes your score lower, then by all means I’d love to see what you came up with. I say go for it! \$\endgroup\$ – X1M4L Mar 29 '18 at 22:50

155 Answers 155

1 2 3 4 5
6
0
\$\begingroup\$

Python (REPL), 16 bytes

'%d bytes'%(8*2)

Output :

16 bytes
| improve this answer | |
\$\endgroup\$
  • 7
    \$\begingroup\$ You could use f-strings like f'{7*2} bytes' \$\endgroup\$ – Jo King Sep 27 '18 at 14:34
  • \$\begingroup\$ Or, if you insist on using an older version of Python, you could use raw string r'%d bytes'%14 \$\endgroup\$ – mypetlion Sep 27 '18 at 16:04
0
\$\begingroup\$

LOLCODE, 66 bytes

Just because it's funny

HAI 1.2,VISIBLE SMOOSH PRODUKT OF 2 AN 33 AN " bytes" MKAY,KTHXBYE

Output

66 bytes

| improve this answer | |
\$\endgroup\$
0
\$\begingroup\$

Go, 46 Bytes

package main;func main(){print(38+8," bytes")}
| improve this answer | |
\$\endgroup\$
  • 3
    \$\begingroup\$ Yeah, but now you have no space between the number and the bytes \$\endgroup\$ – Jo King Sep 27 '18 at 14:40
0
\$\begingroup\$

C (gcc), 32 bytes

main(){printf("%d bytes",8*4);}

Nothing crazy here.

| improve this answer | |
\$\endgroup\$
0
\$\begingroup\$

Commodore 64 - 74 tokenized and BASIC bytes

Assuming by score in bytes, you mean tokens and bytes used by the BASIC interpreter, this works:

0 def fn b(x) = 38911-(fre(x)-2^16*(fre(x)<x)): print fnb(.);"bytes

There is a bug in the FRE() function on the Commodore 64 as it assumes maximum size of BASIC is 32K, or 32768 bytes.

Commodore VIC-20 (unexpanded) - 29 tonkenized and BASIC bytes

0?(60*60-17)-fre(.)"bytes
| improve this answer | |
\$\endgroup\$
1 2 3 4 5
6

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.