|
|
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: 1152 (0x480)
Types: TextFile
Names: »BOLDSPIL.PAS«
└─⟦08ea08c61⟧ Bits:30003924 PolyPascal programmer
└─⟦this⟧ »BOLDSPIL.PAS«
└─⟦092727b26⟧ Bits:30005927 Demoprogrammer til Pascal bog (Jet-80)
└─⟦this⟧ »BOLDSPIL.PAS«
└─⟦3702e543b⟧ Bits:30003064 Demoprogrammer A-J til Pascal bog
└─⟦this⟧ »BOLDSPIL.PAS«
PROGRAM boldspil;
CONST
aslut = 5;
bslut = 3;
maxpoints = 6;
VAR
apoints, bpoints, asejr, bsejr, antal, rnd, i : INTEGER;
BEGIN
WRITE(CLRHOM);
WRITE('Tast antal spil: ');
READLN(antal);
RANDOMIZE;
asejr := 0;
bsejr := 0;
FOR i := 1 TO antal DO
BEGIN
apoints := aslut;
bpoints := bslut;
REPEAT
rnd := RANDOM(2);
IF rnd = 0
THEN apoints := apoints + 1
ELSE bpoints := bpoints + 1;
UNTIL (apoints = maxpoints) OR (bpoints = maxpoints);
IF apoints = maxpoints
THEN asejr := asejr + 1
ELSE bsejr := bsejr + 1;
END;
WRITELN;
WRITELN('Ud af ', antal, ' spil har A vundet ',
asejr / antal * 100 : 5 : 2, ' % og B har vundet ',
bsejr / antal * 100 : 5 : 2, ' %');
WRITELN('Puljen bør deles i forholdet ', ROUND(asejr / antal * 100),
' til ', 100 - ROUND(asejr / antal * 100));
END.
«eof»