Programa
DiceSimulation
Programación
START()
BEGIN
DICESIMVARS();
{}
D1;
{}
D2;
SetSample(H1,D1);
SetFreq(H1,D2);
0
H1Type;
END;
VIEWS "Roll Dice",ROLLMANY()
BEGIN
LOCAL k,roll;
MAKELIST(X+1,X,1,2*SIDES-1,1)
MAKELIST(X+1,X,1,2*SIDES-1,1)
FOR k FROM 1 TO ROLLS DO
roll:=ROLLDIE(SIDES)+ROLLDIE (SIDES);
D2(roll-1)+1
END;
-1
Xmin;
MAX(D1)+1
Xmax;
0
Ymin;
MAX(D2)+1
Ymax;
STARTVIEW(1,1);
END;
VIEWS "Set Sides",SETSIDES()
BEGIN
REPEAT
INPUT(SIDES,"Die Sides","N=","ENTER
num sides",2);
FLOOR(SIDES)
IF SIDES<2 THEN
MSGBOX("Must be >= 2");
END;
UNTIL SIDES >=2;
END;
VIEWS "Set Rolls",SETROLLS()
BEGIN
D2(roll-1);
SIDES;
D1;
D2;
591