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

Because the third and fourth line are the same as the first two lines, it easy to get four lines of output correct:

Here is a way to do it:

The output () now matches the first four lines of the program:

Unfortunately, the program got even longer, and, in a way, we have not gotten closer, but rather further away from a solution. Twelve lines of code produce four lines of output.

Consider the first three lines of the program, and trace their interrelationships:

write('write(');
writequ();
write('write(');

The first marked fragment was the reason to include the second marked fragment (which causes the first fragment to be produced in the output). That second fragment in turn was the reason to include the third marked fragment. But also the third fragment must be output by the program, and hence it must appear somewhere in the program. However, it is not produced by these three program lines.

Maybe an infinitely long program does the trick? But that is not acceptable.

You might get the feeling that it is, in fact, impossible. But it can be done.

How can the program be kept finite? You will need a completely new idea.

Think again, and try your ideas in the machine, and see if you can transform them into a complete solution.

Apply the Hint

It is your turn ...

Need Another Hint?

If you tried this and got stuck again, then you are ready for the .


Valid HTML 4.01 Transitional

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