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.
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? – Post Rock Garf Hunter – 7 years ago
By unique bytes, do you mean shared bytes, or similarity between the two? – KrystosTheOverlord – 7 years ago
@KrystosTheOverlord, it would be simply within program B, with no relation to program A. For example,
aaaaahas one unique byte andabcdehas 5 unique bytes. – Beefster – 7 years ago@Beefster So, if I have a program abcde, would edcba count as original? I feel like I'm just being dumb, but I want to ask just in case – KrystosTheOverlord – 7 years ago
@KrystosTheOverlord I think you're missing something. If Program A is
abcde, thenedcbais not also Program A. If Program B isabcdeoredcbathen either one would have 5 unique bytes. – Kamil Drakari – 7 years ago@KrystosTheOverlord both of those have 5 unique bytes. There is no requirement for originality. Both programs can technically be the same, but you'll have a maximum score of 1 that way. – Beefster – 7 years ago
Am I right that you seem to be implying that multi-byte characters are not allowed in programme B? – Shaggy – 7 years ago
@Shaggy. No. Multibyte characters are fair game, but you'd count it by individual bytes within the encoding. You could use a 16-bit encoding, UTF-8, or whatever floats your boat. – Beefster – 7 years ago
Are both programs required to be in the same language? – Embodiment of Ignorance – 7 years ago
@EmbodimentofIgnorance The question states "A and B may be in different languages." – Kamil Drakari – 7 years ago
1I'm just waiting for the programs where program A is in unary or lenguage – Embodiment of Ignorance – 7 years ago
4@EmbodimentofIgnorance Program A is scored in terms of number of bytes, not unique bytes. Lenguage/Unary would score horribly – Jo King – 7 years ago
Oh, I read it wrong, I thought both programs were scored by unique bytes – Embodiment of Ignorance – 7 years ago
This is definitely the most interesting challenge I've seen so far that has a bowling component. – dfeuer – 7 years ago