1
\$\begingroup\$

This question already has an answer here:

I've been enslaved in a quine factory. The other workers and I can't communicate with the outside world, we can only slave away making quines all day. The masters will reject any work that isn't a proper quine. I'll have to put messages into the quines I make to let people know we're trapped here.

The Challenge

Help us make a quine that a message can be inserted into. It should be a quine such that when an arbitrary message is inserted at a certain point in its source, it still acts as a quine. With this we can send messages out and get rescued.

The Spec

Your submission should be source code and the char position at which a message can be inserted. (Eg 'between the double quotes' or 'between char 17 and 18' or 'at the end')

It's OK if your code doesn't work with a null message. You can submit it with a placeholder message. The placeholder message doesn't count against your score.

We should be able to insert a message containing any of at least,

ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz 0123456789.,!?

Example

The source template:

C1ever_Qu1'm'ne_C0de

Output:

C1ever_Qu1'm'ne_C0de

Score is 19 bytes. The 'm' is not counted because it is the placeholder message.

A message-quine made from the template:

C1ever_Qu1'Help, Im trapped in a quine factory! Please rescue me!'ne_C0de

Output:

C1ever_Qu1'Help, Im trapped in a quine factory! Please rescue me!'ne_C0de

The more of these we can make each day the better, so shortest submission in chars wins.

\$\endgroup\$

marked as duplicate by Muhammad Salman, Herman L, AdmBorkBork code-golf Jun 1 '18 at 19:48

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • \$\begingroup\$ Print a quine that contains the input is quite related to this as well. \$\endgroup\$ – Giuseppe Jun 1 '18 at 20:35
  • \$\begingroup\$ Sorry I'm new here and still learning about quines. How would I add a message to the answers in that question? Seems like every char is very carefully chosen and just typing in some new chars would certainly break those quines. \$\endgroup\$ – Jared K Jun 1 '18 at 21:52
  • \$\begingroup\$ @JaredK Those quines are not all payload-capable (what you're looking for) but many are so it's not really an extension/modification on the other challenge, only a further specification that does not introduce new competitive aspects for which answers should aim. \$\endgroup\$ – HyperNeutrino Jun 2 '18 at 0:55
  • \$\begingroup\$ @JaredK You can add a comment to answers if you want to "add a message to the answers", but I advise against it because those quines are not all meant to be payload-capable. \$\endgroup\$ – HyperNeutrino Jun 2 '18 at 0:56
  • \$\begingroup\$ By 'add a message' to the answer I meant 'add a message , or payload as you say, to the quine. It seems like people won't find this challenging. But should we change it to be a dupe of the answer that @Giuseppe linked? It seems like the spec for that question and my question are trying to create the same challenge. That seems like a more useful way to mark is as dupe than linking it to the generalized quine challenge \$\endgroup\$ – Jared K Jun 2 '18 at 1:42

Browse other questions tagged or ask your own question.