[Search for users]
[Overall Top Noters]
[List of all Conferences]
[Download this site]
Title: | -={ H A C K E R S }=- |
Notice: | Write locked - see NOTED::HACKERS |
Moderator: | DIEHRD::MORRIS |
|
Created: | Thu Feb 20 1986 |
Last Modified: | Mon Aug 03 1992 |
Last Successful Update: | Fri Jun 06 1997 |
Number of topics: | 680 |
Total number of notes: | 5456 |
118.0. "Self writing programs" by EKLV00::BROWN () Wed May 08 1985 20:50
My favorite self replicating program is this one I wrote in standard Pascal
I am working on a DCL equivalent at the moment.
Program Slfrep(Output);
Var I,N:Integer; Q,B:Char; A:Array[1..] Of Packed Array[1..80] Of Char;
Begin
A[1]:="Program Slfrep(Output);";
A[2]:="Var I,N:Integer; Q:Char; A:Array[1..] Of Packed Array[1..80] Of Char;";
A[3]:="Begin";
A[4]:="Q:=\\\\; B:=\ \;";
A[5]:="For I:=1 To 3 Do Writeln(A[N]);";
A[6]:="For I:=1 to 9 Do Writeln(\A[\,I:0,\]:=\,Q,A[N],Q,\;\);";
A[7]:="For I:=11 to 15 Do Writeln(A[N]);
A[8]:="For I:=4 to 6 Do For J:=1 to 80 Do If A[I][J]=B Then A[I][J]:=Q;";
A[9]:="End.";
Q:=""""; B:="\";
For I:=1 To 3 Do Writeln(A[N]);
For I:=1 to 9 Do For J:=1 to 80 Do If A[I][J]=B Then A[I][J]:=Q;
A[4][14]:=B;
For I:=1 to 9 Do Writeln("A[",I:0,"]:=",Q,A[N],Q,";");
For I:=4 to 9 Do Writeln(A[N]);
End.
T.R | Title | User | Personal Name | Date | Lines |
---|
118.1 | | ALIEN::POSTPISCHIL | | Wed May 08 1985 16:29 | 7 |
| For self-replicating programs, see note 95. I think you'll have a hard time
beating the four-line DCL procedure there.
Also, note 115 might be of interest.
-- edp
|