Your goal, is to write a set of programs, that progresses from one to the other, one character at a time. For example. Given the starting program abcd and the ending program wxyz, you should have 5 valid programs, with the respective outputs.
abcd -> wbcd
wbcd -> wxcd
wxcd -> wxyd
wxyd -> wxyz
wxyz -> wxyz
As can be seen, the last program should be a quine.
Rules
- Your start and end program may be any length, And they may also be different lengths
- Your start and end program must contain entirely unique characters at each position, but may share characters overall.
- Each program should affect a single character at a time, in any order, characters should only be added or removed from the end of the program.
- None of your programs need to follow the valid quine rules, they only need to output the correct string.
- Standard Loopholes Apply.
Scoring
Programs are scored by the length of the start program plus the length of the end program in bytes. In the previous example, 4 + 4 = 8, so the score is eight. This is code-golf, so shortest programs wins.
Some Valid Programs
In languages that hopefully don't exist
abcd -> dbcd -> dccd -> dcbd -> dcba
a -> b
a -> b -> bc -> bcd -> bcde
ab -> aa -> ba
[BLANK PROGRAM] -> a
xyz -> xy -> x -> [BLANK PROGRAM]
4 Answers 4
Retina, Score 1
- The empty program outputs
1, since the empty input matches the empty string exactly once. 1outputs0, since1doesn't match the empty input.0outputs0, since0doesn't match the empty input. Since it outputs itself, it's a quine (as defined in this challenge).
-
\$\begingroup\$ You'd technically need to use the latest Retina commit, because the version on TIO still prints trailing linefeeds by default. \$\endgroup\$Martin Ender– Martin Ender2017年07月11日 06:27:57 +00:00Commented Jul 11, 2017 at 6:27
-
2\$\begingroup\$ And I think the empty program is allowed, see the second-to-last example in the challenge. \$\endgroup\$Martin Ender– Martin Ender2017年07月11日 06:28:55 +00:00Commented Jul 11, 2017 at 6:28
-
\$\begingroup\$ @MartinEnder The OP was self-contradictory on this when this answer was posted. \$\endgroup\$Ørjan Johansen– Ørjan Johansen2017年07月11日 14:16:09 +00:00Commented Jul 11, 2017 at 14:16
-
\$\begingroup\$ @ØrjanJohansen which is why I've informed Stewie that it's now been clarified and the answer can be updated. :) \$\endgroup\$Martin Ender– Martin Ender2017年07月11日 14:18:10 +00:00Commented Jul 11, 2017 at 14:18
-
\$\begingroup\$ @MartinEnder Yeah but the examples didn't change, only the part contradicting them. \$\endgroup\$Ørjan Johansen– Ørjan Johansen2017年07月11日 14:22:08 +00:00Commented Jul 11, 2017 at 14:22
05AB1E, Score 1
=
= prints top of stack (nothing) without newline.
(empty program) also generates no output.
Boring solution, but it works.
BLANK PROGRAMis zero bytes right (thus disallowed according to your first rule?) \$\endgroup\$