Novelas
Advertisement
Author Mightyerick (Works) is fine with any constructive edits you wish to make to this literary work.

program sadstory;

using erick, novelas, imagination, doom, shortstory, pascallib, codetemplates;

{$ Bring data.connect=10}

compile with data.

var programmer: new (_programmer);

buggyprogram:new (_programdef);

teston:new(_blackbox);

i:integer;

label TRY_AGAIN;

begin

writeln ('It is a sad story about someone who was programming, found a horrible bug... and died');

with programmer do

begin

programming.create_new_code(buggyprogram, new instance);

TRYAGAIN:

if not programming.started then programming.start else programming.debug;

i:=0;

while not ((programming.compilable and program.value(test_on)) do

begin

programming.write(CODE_TEMPLATE_CONST[i]);

i:=i+1;

end;

{IT IS TERRIBLE: A minimal error in CODE_TEMPLATE_CONST can transform this loop into a Hopeless Endless Radical Do-Nothing Loop. This story would never get an end}

programming.save;

No Error

begin

programming.run;

writeln("It is OK. The program is running");

end

else

writeln("There is a bug. Please try again");

if random(6)=1 then kill(this);

{A self-reference. Each time the programmer fails, there is a likelihood of killing himself due to mental pressure}

if programming.limit_date=TRUE then kill(this);

{If the program remains buggy until the limit date, the programmer kills himself}

goto TRYAGAIN;

end;

truck.smash (programmer);

{Even if the programmer finds the bug, a truck smashes him shortly after, killing him immediatly. Note truck was never initialized, there is a likelihood of getting a Null-Pointer-Operation, destroying the program}

truck.smash (programmer);

{Just to be sure. Indeed, referencing an already destroyed object will crash the program}

end.

{Anyway, there is a very low likelihood of this porgram getting the last end. It could crash at any moment before due to the void references}


{As you see, it is a really sad story. There is not "halt(1)" reference, so if the programmer dies and the program still references him, it will get a null-pointer operation error. May be the program just hangs, may be it is closed by the operating system, may be the system itself fails (It was very usual using Windows 98), may be the program just begins to perform random harmful things onto disk (I got that when using a program I downloaded from the net. Beat me, it was horrible), or may be it just freezes and/or begins to show random output (the most probable way)}

Advertisement