home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Game Killer
/
Game_Killer.bin
/
250.DECOUNT.INC
< prev
next >
Wrap
Text File
|
1991-07-08
|
2KB
|
66 lines
procedure DeadEndAnalysis;
var
len, maxlen : integer;
distrib : array [1..8] of integer;
s : sector;
procedure CheckBackDoor( base : sector );
{ verify no back doors into path }
var
previous, current, NextUp : sector;
begin
write('Tunnel starting at ', base, ' : ');
previous := base;
write( base );
if AppearanceCount( base ) = space.sectors[base].number then
write(' ok ')
else
write(' back door ');
current := space.sectors[base].data[1];
while (space.sectors[current].number = 2) do
begin
write( current );
if AppearanceCount( current ) = space.sectors[current].number then
write(' ok ')
else
write(' back door ');
NextUp := space.sectors[current].data[1];
if NextUp = previous then
NextUp := space.sectors[current].data[2];
previous := current;
current := nextUp;
end; {while}
writeln;
end; {Check Back Door}
begin
for len := 1 to 8 do
distrib[ len ] := 0;
maxlen := 0;
for s := 1 to MaxSector do
if space.sectors[s].number = 1 then
begin
len := howfar( s );
if len > maxlen then
maxlen := len;
distrib[ len ] := distrib[ len ] + 1;
end; {for if}
writeln('Distributions of tunnel lengths:');
for len := 1 to 8 do
write( len : 2, ': ', distrib[len] : 3, '. ');
writeln;
writeln;
writeln('Maximum length of any tunnel is ', maxlen);
writeln;
writeln;
repeat
write('Which lengths do you want to check for 1-way entrances? (0 to exit) ');
readln( len );
if len > 0 then
for s := 1 to MaxSector do
if space.sectors[s].number = 1 then
if howfar(s) = len then
checkBackDoor( s );
until len = 0;
end; {dead end stuff}