Anonymous user
Long stairs: Difference between revisions
m
→{{header|Free Pascal}}: changed to run with gpc 20070904 on ideone https://ideone.com/WlzNjU
(added header pascal) |
m (→{{header|Free Pascal}}: changed to run with gpc 20070904 on ideone https://ideone.com/WlzNjU) |
||
Line 171:
=={{header|Pascal}}==
==={{header|Free Pascal}}===
<lang pascal>program WizardStaircase;
const
StartStairLength = 100;
StairsPerSpell = 5;
rounds = 10000;
procedure OutActual(trials,behind,infront:
begin
writeln(trials:5,infront+behind:12,behind:10,inFront:9);
end;
function OneRun(WithOutput:boolean):
var
inFront,behind,total,i,trials:
begin
trials := 0;
Line 219:
minStairs,
maxStairs,
total :
begin
minStairs := High(minStairs);
Line 225:
randomize;
writeln('Seconds steps total behind ahead');
total := OneRun(true);
total := 0;
For i := rounds-1 downto 0 do
Line 258:
2938.387 average needed seconds</pre>
=={{header|Raku}}==
<lang perl6>my ($trials, $t-total, $s-total) = 10000;
|