|
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 - download
Length: 1408 (0x580) Types: TextFile Names: »NYGAARD.PAS«
└─⟦08ea08c61⟧ Bits:30003924 PolyPascal programmer └─ ⟦this⟧ »NYGAARD.PAS« └─⟦09235ab48⟧ Bits:30003065 Demoprogrammer K-Z til Pascal bog └─ ⟦this⟧ »NYGAARD.PAS« └─⟦092727b26⟧ Bits:30005927 Demoprogrammer til Pascal bog (Jet-80) └─ ⟦this⟧ »NYGAARD.PAS« └─⟦f983c2ef3⟧ Bits:30004681 Pascal opgaver (Butler) └─ ⟦this⟧ »NYGAARD.PAS«
PROGRAM nygaard; VAR asekvens, bsekvens, asejr, bsejr, antal : INTEGER; i, p, q, r, s, sum : INTEGER; afgjort : BOOLEAN; BEGIN WRITE(CLRHOM); WRITE('Tast A''s vindersekvens (f.eks. 1011): '); READLN(asekvens); WRITE('Tast B''s vindersekvens : '); READLN(bsekvens); WRITE('Tast antal spil : '); READLN(antal); RANDOMIZE; asejr := 0; bsejr := 0; FOR i := 1 TO antal DO BEGIN q := RANDOM(2); r := RANDOM(2); s := RANDOM(2); REPEAT afgjort := FALSE; p := q; q := r; r := s; s := RANDOM(2); sum := p * 1000 + q * 100 + r * 10 + s; IF sum = asekvens THEN BEGIN asejr := asejr + 1; afgjort := TRUE; WRITE('A '); END; IF sum = bsekvens THEN BEGIN bsejr := bsejr + 1; afgjort := TRUE; WRITE('B '); END; UNTIL afgjort; END; WRITELN; WRITELN; WRITELN('Ud af ', antal, ' spil har A vundet ', asejr / antal * 100 : 5 : 2, ' % og B har vundet ', bsejr / antal * 100 : 5 : 2, ' %'); END. «eof»