2
\$\begingroup\$

Related

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 , 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]
\$\endgroup\$
  • \$\begingroup\$ If the scoring isn't exactly "length of the code" you should use code-challenge instead. \$\endgroup\$ – FryAmTheEggman Jul 11 '17 at 1:37
  • \$\begingroup\$ I'd disagree, as it's just the length of 2 programs. It's still very much so a golfing challenge. \$\endgroup\$ – ATaco Jul 11 '17 at 1:37
  • \$\begingroup\$ BLANK PROGRAM is zero bytes right (thus disallowed according to your first rule?) \$\endgroup\$ – Stewie Griffin Jul 11 '17 at 2:12
  • \$\begingroup\$ I knew I was going to condradict myself somewhere, fixed. @StewieGriffin \$\endgroup\$ – ATaco Jul 11 '17 at 2:23
  • 1
    \$\begingroup\$ I feel like maybe this should have been code-bowling, since the shorter an answer is, the fewer stages it needs to go through before reaching the end program. \$\endgroup\$ – Unrelated String May 8 at 0:52
5
\$\begingroup\$

Retina, Score 1


Try it online!

  • The empty program outputs 1, since the empty input matches the empty string exactly once.
  • 1 outputs 0, since 1 doesn't match the empty input.
  • 0 outputs 0, since 0 doesn't match the empty input. Since it outputs itself, it's a quine (as defined in this challenge).
\$\endgroup\$
  • \$\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 Jul 11 '17 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 Jul 11 '17 at 6:28
  • \$\begingroup\$ @MartinEnder The OP was self-contradictory on this when this answer was posted. \$\endgroup\$ – Ørjan Johansen Jul 11 '17 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 Jul 11 '17 at 14:18
  • \$\begingroup\$ @MartinEnder Yeah but the examples didn't change, only the part contradicting them. \$\endgroup\$ – Ørjan Johansen Jul 11 '17 at 14:22
1
\$\begingroup\$

05AB1E, Score 1

=

Try it online!

= prints top of stack (nothing) without newline.

 (empty program) also generates no output.

Boring solution, but it works.

\$\endgroup\$
0
\$\begingroup\$

Braingolf, Score 2

/

Try it online!

Niladic / pushes 5, with implicit output, 5 also pushes 5.

\$\endgroup\$
0
\$\begingroup\$

Japt, Score 2

T

Output: 0 (Test it)


0

Output: 0 (Test it)


Any uppercase letter after T would also work in the same way.

\$\endgroup\$

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.