markh@csd4.milw.wisc.edu (Mark William Hopkins) (02/27/88)
This is the description of an interesting project for those who care to pursue it. Write a Pascal program that reproduces itself into another file. The rules are simple: (i) The program file should be placed in Clone1.p on a UNIX. (ii) The program header should be: program Clone(CloneX.p); (iii) The file CloneX.p should be initially empty. (iv) The program in CloneX.p should be identical to the original in Clone.p, except that each occurence of "Clone" is substituted by "CloneX". Further, when this program is run it should produce a copy in the file CloneXX.p with each occurence of "CloneX" replaced by "CloneXX" and so on. By rule (ii), the program should not read ANY input at all (in particular it should not read a copy of itself from a text file, because that would make things too easy). By rule (iv), you should take care to replicate quote marks properly, because a quote cannot be directly quoted in Pascal.