Hints for the Challenge:

Below, you can find another hint for the Challenge.

You should only get here after reading, digesting, and applying the .

Hint

To summarize, our program consists of the following ingredients.

This resembles the way a cell reproduces:

There are also some important differences:

These ideas can be expressed more clearly in the program:

  1. It would be better to put the main program also in a function, aptly named transcribe().
  2. It would be better to have both functions work on parameters, rather than have them work on the global variable S.
  3. It would be appropriate to give string S a better name, such as DNA, or even better Genes, or Blueprint.
  4. There are still some awkward literals (like 3 and 14) in the program. If you have not followed the evolution of this program but see it for the first time, then you will have a hard time understanding why these specific values appear. This also makes it difficult to adapt the program.
  5. We cannot extend the program arbitrarily, because we must (painstakingly) avoid quotes and also vertical bars. (Remember that we have been bitten by that before.) One reason to extend the program is to have it do more than just output itself (compare this to living organisms who do more than just reproduce).

Can you develop an improved solution to meet these new desires?

Try your program in the machine, and see if you can extend it to an improved solution.

Apply the Hint

It is your turn ...

Need Another Hint?

If you tried this hint, or do not see how it helps, then you are ready for the .


Valid HTML 4.01 Transitional

Copyright ©2009, Tom Verhoeff, T.Verhoeff@TUE.NL