Anonymous user
RPG attributes generator: Difference between revisions
correction to Pascal version
(correction to Pascal version) |
|||
Line 495:
=={{header|Pascal|FreePascal}}==
<lang Pascal>
program attributes;
Line 509:
total:=0;
for score :=1 to 6 do begin
{roll:=random(18)+1; produce a number up to 18, pretty much the same results}
repeat▼
for diceroll:=1 to 4
{find lowest rolled dice. If we roll two or more equal low rolls then we
atribs[score]:=roll;▼
eliminate the first of them, change '<' to '<=' to eliminate last low die}
total := total + roll;▼
for diceroll:=1 to 4 do if (dice[diceroll] < lowroll) then begin
until ((total>74) and (count>1));▼
lowroll := dice[diceroll];
lowdie := diceroll;
end;
{add up higest three dice}
roll:=0;
for diceroll:=1 to 4 do if (diceroll <> lowdie) then roll := roll + dice[diceroll];
if (roll>15) then count:=count+1;
▲ until ((total>74) and (count>1)); {this evens out different rolling methods }
{ Prettily print the attributes out }
writeln('Attributes :');
|