var dice : array 1 .. 25 of int
var count : array 1 .. 25 of int
for i : 1 .. 25
dice (i) := Rand.Int (1, 6)
end for
for i : 1 .. 25
count (i) := 0
end for
for i : 1 .. 25
if dice (i) = 1 then
count (1) += 1
put "Rolled a 1 "
elsif dice (i) = 2 then
count (2) += 1
put "Rolled a 2"
elsif dice (i) = 3 then
count (3) += 1
put "Rolled a 3"
elsif dice (i) = 4 then
count (4) += 1
put "Rolled a 4"
elsif dice (i) = 5 then
count (5) += 1
put "Rolled a 5"
elsif dice (i) = 6 then
count (6) += 1
put "Rolled a 6"
end if
end for
for i : 1 .. 6
put "Number of ", i, "'s rolled: ", count (i), " ", count (i) / 25 * 100, "%"
end for
Draw.Box (200, 150, 300, 190, black)
Draw.FillBox (200, 150, round (count (1) / 25 * 100 + 200), 190, black)
for i : 2 .. 6
Draw.FillBox (200 + round (count (i - 1) / 25 * 100 + 200), 150, round (count (i - 1) / 25 * 100 + round (count (i) / 25 * 100 + 200)) , 190, i + 30)
end for
|