|
|
DataMuseum.dkPresents historical artifacts from the history of: CP/M |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about CP/M Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - download
Length: 1024 (0x400)
Types: TextFile
Names: »RNDWALK.PAS«
└─⟦08ea08c61⟧ Bits:30003924 PolyPascal programmer
└─⟦this⟧ »RNDWALK.PAS«
└─⟦09235ab48⟧ Bits:30003065 Demoprogrammer K-Z til Pascal bog
└─⟦this⟧ »RNDWALK.PAS«
└─⟦092727b26⟧ Bits:30005927 Demoprogrammer til Pascal bog (Jet-80)
└─⟦this⟧ »RNDWALK.PAS«
PROGRAM rndwalk;
VAR
radius, radius2, antal, sum, i, x, y, rnd : INTEGER;
BEGIN
WRITE(CLRHOM);
WRITELN('RANDOM WALK');
WRITELN;
WRITE('Tast antal forsøg pr. radius: ');
READLN(antal);
RANDOMIZE;
WRITELN;
WRITELN('RADIUS', 'GENNEMSNITLIG TID' : 30);
WRITELN;
FOR radius := 2 TO 10 DO
BEGIN
radius2:= SQR(radius);
sum := 0;
FOR i := 1 TO antal DO
BEGIN
x := 0;
y := 0;
REPEAT
sum := sum + 1;
rnd := RANDOM(4);
CASE rnd OF
0 : x := x + 1;
1 : y := y + 1;
2 : x := x - 1;
3 : y := y - 1;
END;
UNTIL SQR(x) + SQR(y) >= radius2;
END;
WRITELN(radius : 4, sum / antal : 25 : 2);
END;
END.
«eof»