Meta-bowling Golf
Clash Royale CLAN TAG#URR8PPP
$begingroup$
Your task is to create the shortest program (A) that outputs another program (B) with the most unique bytes, which in turn outputs the original program (A). Essentially, you are golfing one half of a pair of ouroboros programs (a.k.a. periodic iterating quine) and bowling the other half. A and B may be in different languages.
Rules and Scoring
Your final score is <number of unique bytes in B> / <number of bytes in A>
. Highest score wins. It should be noted that the theoretical maximum score is 256.
- Program A must be at least one byte long
- Program B cannot consist entirely of no-ops, i.e. at least one character must affect the output in some way.
Standard rules of quines apply to both programs. Notably, error quines are not allowed in either case.
For the sake of answer format consistency, begin your answer with something like this:
# <Language for A> & <Language for B>, Score: <B score> / <A score> = <combined score>
code-golf code-challenge quine code-bowling
$endgroup$
|
show 8 more comments
$begingroup$
Your task is to create the shortest program (A) that outputs another program (B) with the most unique bytes, which in turn outputs the original program (A). Essentially, you are golfing one half of a pair of ouroboros programs (a.k.a. periodic iterating quine) and bowling the other half. A and B may be in different languages.
Rules and Scoring
Your final score is <number of unique bytes in B> / <number of bytes in A>
. Highest score wins. It should be noted that the theoretical maximum score is 256.
- Program A must be at least one byte long
- Program B cannot consist entirely of no-ops, i.e. at least one character must affect the output in some way.
Standard rules of quines apply to both programs. Notably, error quines are not allowed in either case.
For the sake of answer format consistency, begin your answer with something like this:
# <Language for A> & <Language for B>, Score: <B score> / <A score> = <combined score>
code-golf code-challenge quine code-bowling
$endgroup$
$begingroup$
In order for this to be clear I think you are going to have to clarify the second bullet point a little bit. What does it mean for a character to be a no-op exactly?
$endgroup$
– Sriotchilism O'Zaic
Feb 14 at 17:48
$begingroup$
By unique bytes, do you mean shared bytes, or similarity between the two?
$endgroup$
– KrystosTheOverlord
Feb 14 at 18:50
$begingroup$
@KrystosTheOverlord, it would be simply within program B, with no relation to program A. For example,aaaaa
has one unique byte andabcde
has 5 unique bytes.
$endgroup$
– Beefster
Feb 14 at 18:52
1
$begingroup$
I'm just waiting for the programs where program A is in unary or lenguage
$endgroup$
– Embodiment of Ignorance
Feb 14 at 22:01
1
$begingroup$
@EmbodimentofIgnorance Program A is scored in terms of number of bytes, not unique bytes. Lenguage/Unary would score horribly
$endgroup$
– Jo King
Feb 15 at 0:48
|
show 8 more comments
$begingroup$
Your task is to create the shortest program (A) that outputs another program (B) with the most unique bytes, which in turn outputs the original program (A). Essentially, you are golfing one half of a pair of ouroboros programs (a.k.a. periodic iterating quine) and bowling the other half. A and B may be in different languages.
Rules and Scoring
Your final score is <number of unique bytes in B> / <number of bytes in A>
. Highest score wins. It should be noted that the theoretical maximum score is 256.
- Program A must be at least one byte long
- Program B cannot consist entirely of no-ops, i.e. at least one character must affect the output in some way.
Standard rules of quines apply to both programs. Notably, error quines are not allowed in either case.
For the sake of answer format consistency, begin your answer with something like this:
# <Language for A> & <Language for B>, Score: <B score> / <A score> = <combined score>
code-golf code-challenge quine code-bowling
$endgroup$
Your task is to create the shortest program (A) that outputs another program (B) with the most unique bytes, which in turn outputs the original program (A). Essentially, you are golfing one half of a pair of ouroboros programs (a.k.a. periodic iterating quine) and bowling the other half. A and B may be in different languages.
Rules and Scoring
Your final score is <number of unique bytes in B> / <number of bytes in A>
. Highest score wins. It should be noted that the theoretical maximum score is 256.
- Program A must be at least one byte long
- Program B cannot consist entirely of no-ops, i.e. at least one character must affect the output in some way.
Standard rules of quines apply to both programs. Notably, error quines are not allowed in either case.
For the sake of answer format consistency, begin your answer with something like this:
# <Language for A> & <Language for B>, Score: <B score> / <A score> = <combined score>
code-golf code-challenge quine code-bowling
code-golf code-challenge quine code-bowling
asked Feb 14 at 17:37
BeefsterBeefster
1,976935
1,976935
$begingroup$
In order for this to be clear I think you are going to have to clarify the second bullet point a little bit. What does it mean for a character to be a no-op exactly?
$endgroup$
– Sriotchilism O'Zaic
Feb 14 at 17:48
$begingroup$
By unique bytes, do you mean shared bytes, or similarity between the two?
$endgroup$
– KrystosTheOverlord
Feb 14 at 18:50
$begingroup$
@KrystosTheOverlord, it would be simply within program B, with no relation to program A. For example,aaaaa
has one unique byte andabcde
has 5 unique bytes.
$endgroup$
– Beefster
Feb 14 at 18:52
1
$begingroup$
I'm just waiting for the programs where program A is in unary or lenguage
$endgroup$
– Embodiment of Ignorance
Feb 14 at 22:01
1
$begingroup$
@EmbodimentofIgnorance Program A is scored in terms of number of bytes, not unique bytes. Lenguage/Unary would score horribly
$endgroup$
– Jo King
Feb 15 at 0:48
|
show 8 more comments
$begingroup$
In order for this to be clear I think you are going to have to clarify the second bullet point a little bit. What does it mean for a character to be a no-op exactly?
$endgroup$
– Sriotchilism O'Zaic
Feb 14 at 17:48
$begingroup$
By unique bytes, do you mean shared bytes, or similarity between the two?
$endgroup$
– KrystosTheOverlord
Feb 14 at 18:50
$begingroup$
@KrystosTheOverlord, it would be simply within program B, with no relation to program A. For example,aaaaa
has one unique byte andabcde
has 5 unique bytes.
$endgroup$
– Beefster
Feb 14 at 18:52
1
$begingroup$
I'm just waiting for the programs where program A is in unary or lenguage
$endgroup$
– Embodiment of Ignorance
Feb 14 at 22:01
1
$begingroup$
@EmbodimentofIgnorance Program A is scored in terms of number of bytes, not unique bytes. Lenguage/Unary would score horribly
$endgroup$
– Jo King
Feb 15 at 0:48
$begingroup$
In order for this to be clear I think you are going to have to clarify the second bullet point a little bit. What does it mean for a character to be a no-op exactly?
$endgroup$
– Sriotchilism O'Zaic
Feb 14 at 17:48
$begingroup$
In order for this to be clear I think you are going to have to clarify the second bullet point a little bit. What does it mean for a character to be a no-op exactly?
$endgroup$
– Sriotchilism O'Zaic
Feb 14 at 17:48
$begingroup$
By unique bytes, do you mean shared bytes, or similarity between the two?
$endgroup$
– KrystosTheOverlord
Feb 14 at 18:50
$begingroup$
By unique bytes, do you mean shared bytes, or similarity between the two?
$endgroup$
– KrystosTheOverlord
Feb 14 at 18:50
$begingroup$
@KrystosTheOverlord, it would be simply within program B, with no relation to program A. For example,
aaaaa
has one unique byte and abcde
has 5 unique bytes.$endgroup$
– Beefster
Feb 14 at 18:52
$begingroup$
@KrystosTheOverlord, it would be simply within program B, with no relation to program A. For example,
aaaaa
has one unique byte and abcde
has 5 unique bytes.$endgroup$
– Beefster
Feb 14 at 18:52
1
1
$begingroup$
I'm just waiting for the programs where program A is in unary or lenguage
$endgroup$
– Embodiment of Ignorance
Feb 14 at 22:01
$begingroup$
I'm just waiting for the programs where program A is in unary or lenguage
$endgroup$
– Embodiment of Ignorance
Feb 14 at 22:01
1
1
$begingroup$
@EmbodimentofIgnorance Program A is scored in terms of number of bytes, not unique bytes. Lenguage/Unary would score horribly
$endgroup$
– Jo King
Feb 15 at 0:48
$begingroup$
@EmbodimentofIgnorance Program A is scored in terms of number of bytes, not unique bytes. Lenguage/Unary would score horribly
$endgroup$
– Jo King
Feb 15 at 0:48
|
show 8 more comments
3 Answers
3
active
oldest
votes
$begingroup$
Japt & Japt, Score: 255 / 38 = 6.71
Program A:
"iQ ²¯24
G²õ@i'#+Xd"iQ ²¯24
G²õ@i'#+Xd
Program B is over 8kB long, so long that the link breaks, so I won't paste the whole thing. Here's a sample:
#þ"iQ ²¯24
G²õ@i'#+Xd"iQ ²,#ÿ"iQ ²¯24
G²õ@i'#+Xd"iQ ²,#Ā"iQ ²¯24
G²õ@i'#+Xd"iQ ²
I couldn't find a way to get a NUL
byte to work, which is why program B only has 255 unique characters. Program B essentially consists of 255 copies of a single program, where a single irrelevant byte is changed each time, and the first 254 executions are ignored.
For the explanation, I'll start with this simplified version of A so that the resulting B is easier to discuss.
"iQ ²¯23
3õ@i'#+Xd"iQ ²¯23
3õ@i'#+Xd
This program is based on the basic payload-capable Japt quine. The string at the start contains a duplicate of the rest of the program, iQ ²
inserts a quote and duplicates to create a string representation of the entire program, and then ¯23
trims off itself and everything after it. The resulting string is a program that outputs Program A:
"iQ ²¯23
3õ@i'#+Xd"iQ ²
I will refer to this string as U
.
The last line of A duplicates U
a bunch of times with a small change each time. Specifically, for each number X
in the range [1...3]
it outputs "#c" + U
where c
is the character with charcode X
. The default behavior of Japt is to output those strings with no quotation marks and separated by commas, so this is the output of our Simplified A (note that there's an unprintable byte between each #
and "iQ
:
#"iQ ²¯23
3õ@i'#+Xd"iQ ²,#"iQ ²¯23
3õ@i'#+Xd"iQ ²,#"iQ ²¯23
3õ@i'#+Xd"iQ ²
We'll call this Simplified B.
Simplified B has a simple structure, alternating between #c
and U
. Fortunately for this answer, each #c
and U
is treated as separated by a comma, and in this situation the behavior of that is everything except the very last U
has no effect on the output. The only portion of Simplified B which affects the output is this:
"iQ ²¯23
3õ@i'#+Xd"iQ ²
Which is identical to U
that we already know outputs Simplified A.
The only difference between Simplified A and Program A is that instead of generating copies for the range [1...3]
the real program generates copies for the range [1...256]
. That results in 256 versions of #c
each of which has a different character, though the last version "Ā" is a multi-byte character so it doesn't add any unique bytes, but everything except the last U
is still ignored.
$endgroup$
$begingroup$
Very nice :) Would this work for 38 bytes?
$endgroup$
– Shaggy
Feb 14 at 19:12
$begingroup$
@Shaggy The27
needs to be tweaked whenever bytes are saved, but other than that it seems like it works.
$endgroup$
– Kamil Drakari
Feb 14 at 19:15
1
$begingroup$
@Shaggy The scoring is based on number of unique bytes in B, and there are only 256 possible bytes. As far as I'm aware, even the new version of B does not contain the Null byte.
$endgroup$
– Kamil Drakari
Feb 14 at 19:47
$begingroup$
Tried a few things to get it working with the null byte, by the way, but all failed.
$endgroup$
– Shaggy
Feb 14 at 22:19
add a comment |
$begingroup$
Program A, Gol><>, 256/20 bytes = 12.8
"44XFL|r2ssl3%Q4s]|H
Try it online!
Program B, Gol><>
"44XFL|r2ssl3%Q4s]|H
!"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[]^_`abcdefghijklmnopqrstuvwxyz~
¡¢£¤¥¦§¨©ª«¬®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ
Try it online!
The program alternates between outputting itself followed by every byte and just outputting itself.
Explanation:
" Wrapping string literal pushes the first line to the stack backwards
44X Push 256
FL| Push the range from 0 to 255
r Reverse the stack
2ss Push a quote
l3% If the stack length is divisible by 3
Q4s]| Only take the top 20 characters
H And output the stack
$endgroup$
add a comment |
$begingroup$
Program A: 05AB1E, score: 256/41 256/31 bytes = 8.258...
0"D34çý₅Ýç'q†22ǝ"D34çý₅Ýç'q†22ǝ
Try it online.
Program B: 05AB1E
0"D34çý₅Ýç'q†22ǝ"D34çýq
!"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[]^_`abcdefghijklmnoprstuvwxyz~ ¡¢£¤¥¦§¨©ª«¬®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿÝç'q†22ǝ
Try it online.
Explanation:
The shortest quine for 05AB1E is this one: 0"D34çý"D34çý
(14 bytes) provided by @OliverNi. My answer uses a modified version of that quine by adding ₅Ýç'q†vy27ǝD}J
.
0 # Push a 0 to the stack
# STACK: [0]
"D34çý₅Ýç'q†vDy27ǝ}J"
# Push the string "D34çý₅Ýç'q†vDy27ǝ}J" to the stack
# STACK: [0,"D34çý₅Ýç'q†vDy27ǝ}J"]
D # Duplicate the string
# STACK: [0,"D34çý₅Ýç'q†vDy27ǝ}J","D34çý₅Ýç'q†vDy27ǝ}J"]
34çý # Join the stack by '"'
# STACK: ['0"D34çý₅Ýç'q†vDy27ǝ}J"D34çý₅Ýç'q†vy27ǝD}J']
₅Ý # Push a list in the range [0,255]
ç # Convert each integer to an ASCII character
'q† '# Filter the "q" to the front
22ǝ # Insert it at index 22 in the string (replacing the second '₅')
# (and output the result implicitly)
Program B will terminate as soon as it reaches the q
, so the actual program B is:
0"D34çý₅Ýç'q†22ǝ"D34çýq
Everything after that is ignored, and the top of the stack (0"D34çý₅Ýç'q†22ǝ"D34çý₅Ýç'q†22ǝ
) is output implicitly.
$endgroup$
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
return StackExchange.using("mathjaxEditing", function ()
StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix)
StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["\$", "\$"]]);
);
);
, "mathjax-editing");
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "200"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcodegolf.stackexchange.com%2fquestions%2f179932%2fmeta-bowling-golf%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
$begingroup$
Japt & Japt, Score: 255 / 38 = 6.71
Program A:
"iQ ²¯24
G²õ@i'#+Xd"iQ ²¯24
G²õ@i'#+Xd
Program B is over 8kB long, so long that the link breaks, so I won't paste the whole thing. Here's a sample:
#þ"iQ ²¯24
G²õ@i'#+Xd"iQ ²,#ÿ"iQ ²¯24
G²õ@i'#+Xd"iQ ²,#Ā"iQ ²¯24
G²õ@i'#+Xd"iQ ²
I couldn't find a way to get a NUL
byte to work, which is why program B only has 255 unique characters. Program B essentially consists of 255 copies of a single program, where a single irrelevant byte is changed each time, and the first 254 executions are ignored.
For the explanation, I'll start with this simplified version of A so that the resulting B is easier to discuss.
"iQ ²¯23
3õ@i'#+Xd"iQ ²¯23
3õ@i'#+Xd
This program is based on the basic payload-capable Japt quine. The string at the start contains a duplicate of the rest of the program, iQ ²
inserts a quote and duplicates to create a string representation of the entire program, and then ¯23
trims off itself and everything after it. The resulting string is a program that outputs Program A:
"iQ ²¯23
3õ@i'#+Xd"iQ ²
I will refer to this string as U
.
The last line of A duplicates U
a bunch of times with a small change each time. Specifically, for each number X
in the range [1...3]
it outputs "#c" + U
where c
is the character with charcode X
. The default behavior of Japt is to output those strings with no quotation marks and separated by commas, so this is the output of our Simplified A (note that there's an unprintable byte between each #
and "iQ
:
#"iQ ²¯23
3õ@i'#+Xd"iQ ²,#"iQ ²¯23
3õ@i'#+Xd"iQ ²,#"iQ ²¯23
3õ@i'#+Xd"iQ ²
We'll call this Simplified B.
Simplified B has a simple structure, alternating between #c
and U
. Fortunately for this answer, each #c
and U
is treated as separated by a comma, and in this situation the behavior of that is everything except the very last U
has no effect on the output. The only portion of Simplified B which affects the output is this:
"iQ ²¯23
3õ@i'#+Xd"iQ ²
Which is identical to U
that we already know outputs Simplified A.
The only difference between Simplified A and Program A is that instead of generating copies for the range [1...3]
the real program generates copies for the range [1...256]
. That results in 256 versions of #c
each of which has a different character, though the last version "Ā" is a multi-byte character so it doesn't add any unique bytes, but everything except the last U
is still ignored.
$endgroup$
$begingroup$
Very nice :) Would this work for 38 bytes?
$endgroup$
– Shaggy
Feb 14 at 19:12
$begingroup$
@Shaggy The27
needs to be tweaked whenever bytes are saved, but other than that it seems like it works.
$endgroup$
– Kamil Drakari
Feb 14 at 19:15
1
$begingroup$
@Shaggy The scoring is based on number of unique bytes in B, and there are only 256 possible bytes. As far as I'm aware, even the new version of B does not contain the Null byte.
$endgroup$
– Kamil Drakari
Feb 14 at 19:47
$begingroup$
Tried a few things to get it working with the null byte, by the way, but all failed.
$endgroup$
– Shaggy
Feb 14 at 22:19
add a comment |
$begingroup$
Japt & Japt, Score: 255 / 38 = 6.71
Program A:
"iQ ²¯24
G²õ@i'#+Xd"iQ ²¯24
G²õ@i'#+Xd
Program B is over 8kB long, so long that the link breaks, so I won't paste the whole thing. Here's a sample:
#þ"iQ ²¯24
G²õ@i'#+Xd"iQ ²,#ÿ"iQ ²¯24
G²õ@i'#+Xd"iQ ²,#Ā"iQ ²¯24
G²õ@i'#+Xd"iQ ²
I couldn't find a way to get a NUL
byte to work, which is why program B only has 255 unique characters. Program B essentially consists of 255 copies of a single program, where a single irrelevant byte is changed each time, and the first 254 executions are ignored.
For the explanation, I'll start with this simplified version of A so that the resulting B is easier to discuss.
"iQ ²¯23
3õ@i'#+Xd"iQ ²¯23
3õ@i'#+Xd
This program is based on the basic payload-capable Japt quine. The string at the start contains a duplicate of the rest of the program, iQ ²
inserts a quote and duplicates to create a string representation of the entire program, and then ¯23
trims off itself and everything after it. The resulting string is a program that outputs Program A:
"iQ ²¯23
3õ@i'#+Xd"iQ ²
I will refer to this string as U
.
The last line of A duplicates U
a bunch of times with a small change each time. Specifically, for each number X
in the range [1...3]
it outputs "#c" + U
where c
is the character with charcode X
. The default behavior of Japt is to output those strings with no quotation marks and separated by commas, so this is the output of our Simplified A (note that there's an unprintable byte between each #
and "iQ
:
#"iQ ²¯23
3õ@i'#+Xd"iQ ²,#"iQ ²¯23
3õ@i'#+Xd"iQ ²,#"iQ ²¯23
3õ@i'#+Xd"iQ ²
We'll call this Simplified B.
Simplified B has a simple structure, alternating between #c
and U
. Fortunately for this answer, each #c
and U
is treated as separated by a comma, and in this situation the behavior of that is everything except the very last U
has no effect on the output. The only portion of Simplified B which affects the output is this:
"iQ ²¯23
3õ@i'#+Xd"iQ ²
Which is identical to U
that we already know outputs Simplified A.
The only difference between Simplified A and Program A is that instead of generating copies for the range [1...3]
the real program generates copies for the range [1...256]
. That results in 256 versions of #c
each of which has a different character, though the last version "Ā" is a multi-byte character so it doesn't add any unique bytes, but everything except the last U
is still ignored.
$endgroup$
$begingroup$
Very nice :) Would this work for 38 bytes?
$endgroup$
– Shaggy
Feb 14 at 19:12
$begingroup$
@Shaggy The27
needs to be tweaked whenever bytes are saved, but other than that it seems like it works.
$endgroup$
– Kamil Drakari
Feb 14 at 19:15
1
$begingroup$
@Shaggy The scoring is based on number of unique bytes in B, and there are only 256 possible bytes. As far as I'm aware, even the new version of B does not contain the Null byte.
$endgroup$
– Kamil Drakari
Feb 14 at 19:47
$begingroup$
Tried a few things to get it working with the null byte, by the way, but all failed.
$endgroup$
– Shaggy
Feb 14 at 22:19
add a comment |
$begingroup$
Japt & Japt, Score: 255 / 38 = 6.71
Program A:
"iQ ²¯24
G²õ@i'#+Xd"iQ ²¯24
G²õ@i'#+Xd
Program B is over 8kB long, so long that the link breaks, so I won't paste the whole thing. Here's a sample:
#þ"iQ ²¯24
G²õ@i'#+Xd"iQ ²,#ÿ"iQ ²¯24
G²õ@i'#+Xd"iQ ²,#Ā"iQ ²¯24
G²õ@i'#+Xd"iQ ²
I couldn't find a way to get a NUL
byte to work, which is why program B only has 255 unique characters. Program B essentially consists of 255 copies of a single program, where a single irrelevant byte is changed each time, and the first 254 executions are ignored.
For the explanation, I'll start with this simplified version of A so that the resulting B is easier to discuss.
"iQ ²¯23
3õ@i'#+Xd"iQ ²¯23
3õ@i'#+Xd
This program is based on the basic payload-capable Japt quine. The string at the start contains a duplicate of the rest of the program, iQ ²
inserts a quote and duplicates to create a string representation of the entire program, and then ¯23
trims off itself and everything after it. The resulting string is a program that outputs Program A:
"iQ ²¯23
3õ@i'#+Xd"iQ ²
I will refer to this string as U
.
The last line of A duplicates U
a bunch of times with a small change each time. Specifically, for each number X
in the range [1...3]
it outputs "#c" + U
where c
is the character with charcode X
. The default behavior of Japt is to output those strings with no quotation marks and separated by commas, so this is the output of our Simplified A (note that there's an unprintable byte between each #
and "iQ
:
#"iQ ²¯23
3õ@i'#+Xd"iQ ²,#"iQ ²¯23
3õ@i'#+Xd"iQ ²,#"iQ ²¯23
3õ@i'#+Xd"iQ ²
We'll call this Simplified B.
Simplified B has a simple structure, alternating between #c
and U
. Fortunately for this answer, each #c
and U
is treated as separated by a comma, and in this situation the behavior of that is everything except the very last U
has no effect on the output. The only portion of Simplified B which affects the output is this:
"iQ ²¯23
3õ@i'#+Xd"iQ ²
Which is identical to U
that we already know outputs Simplified A.
The only difference between Simplified A and Program A is that instead of generating copies for the range [1...3]
the real program generates copies for the range [1...256]
. That results in 256 versions of #c
each of which has a different character, though the last version "Ā" is a multi-byte character so it doesn't add any unique bytes, but everything except the last U
is still ignored.
$endgroup$
Japt & Japt, Score: 255 / 38 = 6.71
Program A:
"iQ ²¯24
G²õ@i'#+Xd"iQ ²¯24
G²õ@i'#+Xd
Program B is over 8kB long, so long that the link breaks, so I won't paste the whole thing. Here's a sample:
#þ"iQ ²¯24
G²õ@i'#+Xd"iQ ²,#ÿ"iQ ²¯24
G²õ@i'#+Xd"iQ ²,#Ā"iQ ²¯24
G²õ@i'#+Xd"iQ ²
I couldn't find a way to get a NUL
byte to work, which is why program B only has 255 unique characters. Program B essentially consists of 255 copies of a single program, where a single irrelevant byte is changed each time, and the first 254 executions are ignored.
For the explanation, I'll start with this simplified version of A so that the resulting B is easier to discuss.
"iQ ²¯23
3õ@i'#+Xd"iQ ²¯23
3õ@i'#+Xd
This program is based on the basic payload-capable Japt quine. The string at the start contains a duplicate of the rest of the program, iQ ²
inserts a quote and duplicates to create a string representation of the entire program, and then ¯23
trims off itself and everything after it. The resulting string is a program that outputs Program A:
"iQ ²¯23
3õ@i'#+Xd"iQ ²
I will refer to this string as U
.
The last line of A duplicates U
a bunch of times with a small change each time. Specifically, for each number X
in the range [1...3]
it outputs "#c" + U
where c
is the character with charcode X
. The default behavior of Japt is to output those strings with no quotation marks and separated by commas, so this is the output of our Simplified A (note that there's an unprintable byte between each #
and "iQ
:
#"iQ ²¯23
3õ@i'#+Xd"iQ ²,#"iQ ²¯23
3õ@i'#+Xd"iQ ²,#"iQ ²¯23
3õ@i'#+Xd"iQ ²
We'll call this Simplified B.
Simplified B has a simple structure, alternating between #c
and U
. Fortunately for this answer, each #c
and U
is treated as separated by a comma, and in this situation the behavior of that is everything except the very last U
has no effect on the output. The only portion of Simplified B which affects the output is this:
"iQ ²¯23
3õ@i'#+Xd"iQ ²
Which is identical to U
that we already know outputs Simplified A.
The only difference between Simplified A and Program A is that instead of generating copies for the range [1...3]
the real program generates copies for the range [1...256]
. That results in 256 versions of #c
each of which has a different character, though the last version "Ā" is a multi-byte character so it doesn't add any unique bytes, but everything except the last U
is still ignored.
edited Feb 25 at 14:26
answered Feb 14 at 18:53
Kamil DrakariKamil Drakari
3,441417
3,441417
$begingroup$
Very nice :) Would this work for 38 bytes?
$endgroup$
– Shaggy
Feb 14 at 19:12
$begingroup$
@Shaggy The27
needs to be tweaked whenever bytes are saved, but other than that it seems like it works.
$endgroup$
– Kamil Drakari
Feb 14 at 19:15
1
$begingroup$
@Shaggy The scoring is based on number of unique bytes in B, and there are only 256 possible bytes. As far as I'm aware, even the new version of B does not contain the Null byte.
$endgroup$
– Kamil Drakari
Feb 14 at 19:47
$begingroup$
Tried a few things to get it working with the null byte, by the way, but all failed.
$endgroup$
– Shaggy
Feb 14 at 22:19
add a comment |
$begingroup$
Very nice :) Would this work for 38 bytes?
$endgroup$
– Shaggy
Feb 14 at 19:12
$begingroup$
@Shaggy The27
needs to be tweaked whenever bytes are saved, but other than that it seems like it works.
$endgroup$
– Kamil Drakari
Feb 14 at 19:15
1
$begingroup$
@Shaggy The scoring is based on number of unique bytes in B, and there are only 256 possible bytes. As far as I'm aware, even the new version of B does not contain the Null byte.
$endgroup$
– Kamil Drakari
Feb 14 at 19:47
$begingroup$
Tried a few things to get it working with the null byte, by the way, but all failed.
$endgroup$
– Shaggy
Feb 14 at 22:19
$begingroup$
Very nice :) Would this work for 38 bytes?
$endgroup$
– Shaggy
Feb 14 at 19:12
$begingroup$
Very nice :) Would this work for 38 bytes?
$endgroup$
– Shaggy
Feb 14 at 19:12
$begingroup$
@Shaggy The
27
needs to be tweaked whenever bytes are saved, but other than that it seems like it works.$endgroup$
– Kamil Drakari
Feb 14 at 19:15
$begingroup$
@Shaggy The
27
needs to be tweaked whenever bytes are saved, but other than that it seems like it works.$endgroup$
– Kamil Drakari
Feb 14 at 19:15
1
1
$begingroup$
@Shaggy The scoring is based on number of unique bytes in B, and there are only 256 possible bytes. As far as I'm aware, even the new version of B does not contain the Null byte.
$endgroup$
– Kamil Drakari
Feb 14 at 19:47
$begingroup$
@Shaggy The scoring is based on number of unique bytes in B, and there are only 256 possible bytes. As far as I'm aware, even the new version of B does not contain the Null byte.
$endgroup$
– Kamil Drakari
Feb 14 at 19:47
$begingroup$
Tried a few things to get it working with the null byte, by the way, but all failed.
$endgroup$
– Shaggy
Feb 14 at 22:19
$begingroup$
Tried a few things to get it working with the null byte, by the way, but all failed.
$endgroup$
– Shaggy
Feb 14 at 22:19
add a comment |
$begingroup$
Program A, Gol><>, 256/20 bytes = 12.8
"44XFL|r2ssl3%Q4s]|H
Try it online!
Program B, Gol><>
"44XFL|r2ssl3%Q4s]|H
!"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[]^_`abcdefghijklmnopqrstuvwxyz~
¡¢£¤¥¦§¨©ª«¬®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ
Try it online!
The program alternates between outputting itself followed by every byte and just outputting itself.
Explanation:
" Wrapping string literal pushes the first line to the stack backwards
44X Push 256
FL| Push the range from 0 to 255
r Reverse the stack
2ss Push a quote
l3% If the stack length is divisible by 3
Q4s]| Only take the top 20 characters
H And output the stack
$endgroup$
add a comment |
$begingroup$
Program A, Gol><>, 256/20 bytes = 12.8
"44XFL|r2ssl3%Q4s]|H
Try it online!
Program B, Gol><>
"44XFL|r2ssl3%Q4s]|H
!"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[]^_`abcdefghijklmnopqrstuvwxyz~
¡¢£¤¥¦§¨©ª«¬®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ
Try it online!
The program alternates between outputting itself followed by every byte and just outputting itself.
Explanation:
" Wrapping string literal pushes the first line to the stack backwards
44X Push 256
FL| Push the range from 0 to 255
r Reverse the stack
2ss Push a quote
l3% If the stack length is divisible by 3
Q4s]| Only take the top 20 characters
H And output the stack
$endgroup$
add a comment |
$begingroup$
Program A, Gol><>, 256/20 bytes = 12.8
"44XFL|r2ssl3%Q4s]|H
Try it online!
Program B, Gol><>
"44XFL|r2ssl3%Q4s]|H
!"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[]^_`abcdefghijklmnopqrstuvwxyz~
¡¢£¤¥¦§¨©ª«¬®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ
Try it online!
The program alternates between outputting itself followed by every byte and just outputting itself.
Explanation:
" Wrapping string literal pushes the first line to the stack backwards
44X Push 256
FL| Push the range from 0 to 255
r Reverse the stack
2ss Push a quote
l3% If the stack length is divisible by 3
Q4s]| Only take the top 20 characters
H And output the stack
$endgroup$
Program A, Gol><>, 256/20 bytes = 12.8
"44XFL|r2ssl3%Q4s]|H
Try it online!
Program B, Gol><>
"44XFL|r2ssl3%Q4s]|H
!"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[]^_`abcdefghijklmnopqrstuvwxyz~
¡¢£¤¥¦§¨©ª«¬®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ
Try it online!
The program alternates between outputting itself followed by every byte and just outputting itself.
Explanation:
" Wrapping string literal pushes the first line to the stack backwards
44X Push 256
FL| Push the range from 0 to 255
r Reverse the stack
2ss Push a quote
l3% If the stack length is divisible by 3
Q4s]| Only take the top 20 characters
H And output the stack
answered Feb 15 at 2:23
Jo KingJo King
24.5k357126
24.5k357126
add a comment |
add a comment |
$begingroup$
Program A: 05AB1E, score: 256/41 256/31 bytes = 8.258...
0"D34çý₅Ýç'q†22ǝ"D34çý₅Ýç'q†22ǝ
Try it online.
Program B: 05AB1E
0"D34çý₅Ýç'q†22ǝ"D34çýq
!"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[]^_`abcdefghijklmnoprstuvwxyz~ ¡¢£¤¥¦§¨©ª«¬®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿÝç'q†22ǝ
Try it online.
Explanation:
The shortest quine for 05AB1E is this one: 0"D34çý"D34çý
(14 bytes) provided by @OliverNi. My answer uses a modified version of that quine by adding ₅Ýç'q†vy27ǝD}J
.
0 # Push a 0 to the stack
# STACK: [0]
"D34çý₅Ýç'q†vDy27ǝ}J"
# Push the string "D34çý₅Ýç'q†vDy27ǝ}J" to the stack
# STACK: [0,"D34çý₅Ýç'q†vDy27ǝ}J"]
D # Duplicate the string
# STACK: [0,"D34çý₅Ýç'q†vDy27ǝ}J","D34çý₅Ýç'q†vDy27ǝ}J"]
34çý # Join the stack by '"'
# STACK: ['0"D34çý₅Ýç'q†vDy27ǝ}J"D34çý₅Ýç'q†vy27ǝD}J']
₅Ý # Push a list in the range [0,255]
ç # Convert each integer to an ASCII character
'q† '# Filter the "q" to the front
22ǝ # Insert it at index 22 in the string (replacing the second '₅')
# (and output the result implicitly)
Program B will terminate as soon as it reaches the q
, so the actual program B is:
0"D34çý₅Ýç'q†22ǝ"D34çýq
Everything after that is ignored, and the top of the stack (0"D34çý₅Ýç'q†22ǝ"D34çý₅Ýç'q†22ǝ
) is output implicitly.
$endgroup$
add a comment |
$begingroup$
Program A: 05AB1E, score: 256/41 256/31 bytes = 8.258...
0"D34çý₅Ýç'q†22ǝ"D34çý₅Ýç'q†22ǝ
Try it online.
Program B: 05AB1E
0"D34çý₅Ýç'q†22ǝ"D34çýq
!"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[]^_`abcdefghijklmnoprstuvwxyz~ ¡¢£¤¥¦§¨©ª«¬®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿÝç'q†22ǝ
Try it online.
Explanation:
The shortest quine for 05AB1E is this one: 0"D34çý"D34çý
(14 bytes) provided by @OliverNi. My answer uses a modified version of that quine by adding ₅Ýç'q†vy27ǝD}J
.
0 # Push a 0 to the stack
# STACK: [0]
"D34çý₅Ýç'q†vDy27ǝ}J"
# Push the string "D34çý₅Ýç'q†vDy27ǝ}J" to the stack
# STACK: [0,"D34çý₅Ýç'q†vDy27ǝ}J"]
D # Duplicate the string
# STACK: [0,"D34çý₅Ýç'q†vDy27ǝ}J","D34çý₅Ýç'q†vDy27ǝ}J"]
34çý # Join the stack by '"'
# STACK: ['0"D34çý₅Ýç'q†vDy27ǝ}J"D34çý₅Ýç'q†vy27ǝD}J']
₅Ý # Push a list in the range [0,255]
ç # Convert each integer to an ASCII character
'q† '# Filter the "q" to the front
22ǝ # Insert it at index 22 in the string (replacing the second '₅')
# (and output the result implicitly)
Program B will terminate as soon as it reaches the q
, so the actual program B is:
0"D34çý₅Ýç'q†22ǝ"D34çýq
Everything after that is ignored, and the top of the stack (0"D34çý₅Ýç'q†22ǝ"D34çý₅Ýç'q†22ǝ
) is output implicitly.
$endgroup$
add a comment |
$begingroup$
Program A: 05AB1E, score: 256/41 256/31 bytes = 8.258...
0"D34çý₅Ýç'q†22ǝ"D34çý₅Ýç'q†22ǝ
Try it online.
Program B: 05AB1E
0"D34çý₅Ýç'q†22ǝ"D34çýq
!"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[]^_`abcdefghijklmnoprstuvwxyz~ ¡¢£¤¥¦§¨©ª«¬®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿÝç'q†22ǝ
Try it online.
Explanation:
The shortest quine for 05AB1E is this one: 0"D34çý"D34çý
(14 bytes) provided by @OliverNi. My answer uses a modified version of that quine by adding ₅Ýç'q†vy27ǝD}J
.
0 # Push a 0 to the stack
# STACK: [0]
"D34çý₅Ýç'q†vDy27ǝ}J"
# Push the string "D34çý₅Ýç'q†vDy27ǝ}J" to the stack
# STACK: [0,"D34çý₅Ýç'q†vDy27ǝ}J"]
D # Duplicate the string
# STACK: [0,"D34çý₅Ýç'q†vDy27ǝ}J","D34çý₅Ýç'q†vDy27ǝ}J"]
34çý # Join the stack by '"'
# STACK: ['0"D34çý₅Ýç'q†vDy27ǝ}J"D34çý₅Ýç'q†vy27ǝD}J']
₅Ý # Push a list in the range [0,255]
ç # Convert each integer to an ASCII character
'q† '# Filter the "q" to the front
22ǝ # Insert it at index 22 in the string (replacing the second '₅')
# (and output the result implicitly)
Program B will terminate as soon as it reaches the q
, so the actual program B is:
0"D34çý₅Ýç'q†22ǝ"D34çýq
Everything after that is ignored, and the top of the stack (0"D34çý₅Ýç'q†22ǝ"D34çý₅Ýç'q†22ǝ
) is output implicitly.
$endgroup$
Program A: 05AB1E, score: 256/41 256/31 bytes = 8.258...
0"D34çý₅Ýç'q†22ǝ"D34çý₅Ýç'q†22ǝ
Try it online.
Program B: 05AB1E
0"D34çý₅Ýç'q†22ǝ"D34çýq
!"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[]^_`abcdefghijklmnoprstuvwxyz~ ¡¢£¤¥¦§¨©ª«¬®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿÝç'q†22ǝ
Try it online.
Explanation:
The shortest quine for 05AB1E is this one: 0"D34çý"D34çý
(14 bytes) provided by @OliverNi. My answer uses a modified version of that quine by adding ₅Ýç'q†vy27ǝD}J
.
0 # Push a 0 to the stack
# STACK: [0]
"D34çý₅Ýç'q†vDy27ǝ}J"
# Push the string "D34çý₅Ýç'q†vDy27ǝ}J" to the stack
# STACK: [0,"D34çý₅Ýç'q†vDy27ǝ}J"]
D # Duplicate the string
# STACK: [0,"D34çý₅Ýç'q†vDy27ǝ}J","D34çý₅Ýç'q†vDy27ǝ}J"]
34çý # Join the stack by '"'
# STACK: ['0"D34çý₅Ýç'q†vDy27ǝ}J"D34çý₅Ýç'q†vy27ǝD}J']
₅Ý # Push a list in the range [0,255]
ç # Convert each integer to an ASCII character
'q† '# Filter the "q" to the front
22ǝ # Insert it at index 22 in the string (replacing the second '₅')
# (and output the result implicitly)
Program B will terminate as soon as it reaches the q
, so the actual program B is:
0"D34çý₅Ýç'q†22ǝ"D34çýq
Everything after that is ignored, and the top of the stack (0"D34çý₅Ýç'q†22ǝ"D34çý₅Ýç'q†22ǝ
) is output implicitly.
edited Feb 15 at 9:50
answered Feb 15 at 9:37
Kevin CruijssenKevin Cruijssen
40.1k563206
40.1k563206
add a comment |
add a comment |
If this is an answer to a challenge…
…Be sure to follow the challenge specification. However, please refrain from exploiting obvious loopholes. Answers abusing any of the standard loopholes are considered invalid. If you think a specification is unclear or underspecified, comment on the question instead.
…Try to optimize your score. For instance, answers to code-golf challenges should attempt to be as short as possible. You can always include a readable version of the code in addition to the competitive one.
Explanations of your answer make it more interesting to read and are very much encouraged.…Include a short header which indicates the language(s) of your code and its score, as defined by the challenge.
More generally…
…Please make sure to answer the question and provide sufficient detail.
…Avoid asking for help, clarification or responding to other answers (use comments instead).
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcodegolf.stackexchange.com%2fquestions%2f179932%2fmeta-bowling-golf%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
$begingroup$
In order for this to be clear I think you are going to have to clarify the second bullet point a little bit. What does it mean for a character to be a no-op exactly?
$endgroup$
– Sriotchilism O'Zaic
Feb 14 at 17:48
$begingroup$
By unique bytes, do you mean shared bytes, or similarity between the two?
$endgroup$
– KrystosTheOverlord
Feb 14 at 18:50
$begingroup$
@KrystosTheOverlord, it would be simply within program B, with no relation to program A. For example,
aaaaa
has one unique byte andabcde
has 5 unique bytes.$endgroup$
– Beefster
Feb 14 at 18:52
1
$begingroup$
I'm just waiting for the programs where program A is in unary or lenguage
$endgroup$
– Embodiment of Ignorance
Feb 14 at 22:01
1
$begingroup$
@EmbodimentofIgnorance Program A is scored in terms of number of bytes, not unique bytes. Lenguage/Unary would score horribly
$endgroup$
– Jo King
Feb 15 at 0:48