help with dice for turing

Computer builds, hardware and software discussion or troubleshooting, including peripherals. Essentially a general place to talk about desktop computers.
Locked
Anonymous

help with dice for turing

Post by Anonymous »

:huh:
this is my dice i need to modify so it shows a chart after 100 rolls that how many times each number came also i need help making a graph for it thankz

setscreen ("graphics")

var die1, die2, die3, die4 : int
var number : int
var amount, wager : real
procedure box1
drawbox (100, 100, 200, 200, 7)
drawfill (101, 101, 3, 7)
end box1
procedure box2
drawbox (250, 100, 350, 200, 7)
drawfill (251, 101, 3, 7)
end box2
loop
drawfill (99, 99, 5, 7)
randint (die1, 1, 6)
randint (die2, 1, 6)
if die1 = 1 then
drawbox (140, 140, 160, 160, 7)
drawfill (141, 141, 7, 7)
end if
if die2 = 1 then
drawbox (290, 160, 310, 140, 7)
drawfill (291, 159, 7, 7)
end if
if die1 = 2 then
drawbox (115, 186, 135, 165, 7)
drawfill (116, 185, 7, 7)
drawbox (185, 115, 165, 135, 7)
drawfill (184, 116, 7, 7)
end if
if die2 = 2 then
drawbox (265, 186, 285, 165, 7)
drawfill (266, 185, 7, 7)
drawbox (315, 115, 335, 135, 7)
drawfill (316, 116, 7, 7)
end if
if die1 = 3 then
drawbox (140, 140, 160, 160, 7)
drawfill (141, 141, 7, 7)
drawbox (115, 186, 135, 165, 7)
drawfill (116, 185, 7, 7)
drawbox (185, 115, 165, 135, 7)
drawfill (184, 116, 7, 7)
end if
if die2 = 3 then
drawbox (290, 160, 310, 140, 7)
drawfill (291, 159, 7, 7)
drawbox (265, 186, 285, 165, 7)
drawfill (266, 185, 7, 7)
drawbox (315, 115, 335, 135, 7)
drawfill (316, 116, 7, 7)
end if
if die1 = 4 then
drawbox (115, 186, 135, 165, 7)
drawfill (116, 185, 7, 7)
drawbox (185, 115, 165, 135, 7)
drawfill (184, 116, 7, 7)
drawbox (115, 115, 135, 135, 7)
drawfill (116, 116, 7, 7)
drawbox (165, 185, 185, 165, 7)
drawfill (166, 184, 7, 7)
end if
if die2 = 4 then
drawbox (265, 186, 285, 165, 7)
drawfill (266, 185, 7, 7)
drawbox (315, 115, 335, 135, 7)
drawfill (316, 116, 7, 7)
drawbox (315, 186, 335, 165, 7)
drawfill (316, 185, 7, 7)
drawbox (265, 115, 285, 135, 7)
drawfill (266, 116, 7, 7)
end if
if die1 = 5 then
drawbox (115, 186, 135, 165, 7)
drawfill (116, 185, 7, 7)
drawbox (185, 115, 165, 135, 7)
drawfill (184, 116, 7, 7)
drawbox (115, 115, 135, 135, 7)
drawfill (116, 116, 7, 7)
drawbox (165, 185, 185, 165, 7)
drawfill (166, 184, 7, 7)
drawbox (140, 140, 160, 160, 7)
drawfill (141, 141, 7, 7)
end if
if die2 = 5 then
drawbox (265, 186, 285, 165, 7)
drawfill (266, 185, 7, 7)
drawbox (315, 115, 335, 135, 7)
drawfill (316, 116, 7, 7)
drawbox (315, 186, 335, 165, 7)
drawfill (316, 185, 7, 7)
drawbox (265, 115, 285, 135, 7)
drawfill (266, 116, 7, 7)
drawbox (290, 160, 310, 140, 7)
drawfill (291, 159, 7, 7)
end if
if die1 = 6 then
drawbox (115, 186, 135, 165, 7)
drawfill (116, 185, 7, 7)
drawbox (185, 115, 165, 135, 7)
drawfill (184, 116, 7, 7)
drawbox (115, 115, 135, 135, 7)
drawfill (116, 116, 7, 7)
drawbox (165, 185, 185, 165, 7)
drawfill (166, 184, 7, 7)
drawbox (115, 140, 135, 160, 7)
drawfill (116, 141, 7, 7)
drawbox (185, 139, 165, 160, 7)
drawfill (184, 140, 7, 7)
end if
if die2 = 6 then
drawbox (265, 186, 285, 165, 7)
drawfill (266, 185, 7, 7)
drawbox (315, 115, 335, 135, 7)
drawfill (316, 116, 7, 7)
drawbox (315, 186, 335, 165, 7)
drawfill (316, 185, 7, 7)
drawbox (265, 115, 285, 135, 7)
drawfill (266, 116, 7, 7)
drawbox (265, 160, 285, 140, 7)
drawfill (266, 159, 7, 7)
drawbox (315, 160, 335, 140, 7)
drawfill (316, 159, 7, 7)
end if
delay (500)
cls

randomize
box1
box2
%Fills in the background
drawfill (99, 99, 5, 7)
randint (die3, 1, 6)
randint (die4, 1, 6)
if die3 = 1 then
drawbox (140, 140, 160, 160, 7)
drawfill (141, 141, 7, 7)
end if
if die4 = 1 then
drawbox (290, 160, 310, 140, 7)
drawfill (291, 159, 7, 7)
end if
if die3 = 2 then
drawbox (115, 186, 135, 165, 7)
drawfill (116, 185, 7, 7)
drawbox (185, 115, 165, 135, 7)
drawfill (184, 116, 7, 7)
end if
if die4 = 2 then
drawbox (265, 186, 285, 165, 7)
drawfill (266, 185, 7, 7)
drawbox (315, 115, 335, 135, 7)
drawfill (316, 116, 7, 7)
end if
if die3 = 3 then
drawbox (140, 140, 160, 160, 7)
drawfill (141, 141, 7, 7)
drawbox (115, 186, 135, 165, 7)
drawfill (116, 185, 7, 7)
drawbox (185, 115, 165, 135, 7)
drawfill (184, 116, 7, 7)
end if
if die4 = 3 then
drawbox (290, 160, 310, 140, 7)
drawfill (291, 159, 7, 7)
drawbox (265, 186, 285, 165, 7)
drawfill (266, 185, 7, 7)
drawbox (315, 115, 335, 135, 7)
drawfill (316, 116, 7, 7)
end if
if die3 = 4 then
drawbox (115, 186, 135, 165, 7)
drawfill (116, 185, 7, 7)
drawbox (185, 115, 165, 135, 7)
drawfill (184, 116, 7, 7)
drawbox (115, 115, 135, 135, 7)
drawfill (116, 116, 7, 7)
drawbox (165, 185, 185, 165, 7)
drawfill (166, 184, 7, 7)
end if
if die4 = 4 then
drawbox (265, 186, 285, 165, 7)
drawfill (266, 185, 7, 7)
drawbox (315, 115, 335, 135, 7)
drawfill (316, 116, 7, 7)
drawbox (315, 186, 335, 165, 7)
drawfill (316, 185, 7, 7)
drawbox (265, 115, 285, 135, 7)
drawfill (266, 116, 7, 7)
end if
if die3 = 5 then
drawbox (115, 186, 135, 165, 7)
drawfill (116, 185, 7, 7)
drawbox (185, 115, 165, 135, 7)
drawfill (184, 116, 7, 7)
drawbox (115, 115, 135, 135, 7)
drawfill (116, 116, 7, 7)
drawbox (165, 185, 185, 165, 7)
drawfill (166, 184, 7, 7)
drawbox (140, 140, 160, 160, 7)
drawfill (141, 141, 7, 7)
end if
if die4 = 5 then
drawbox (265, 186, 285, 165, 7)
drawfill (266, 185, 7, 7)
drawbox (315, 115, 335, 135, 7)
drawfill (316, 116, 7, 7)
drawbox (315, 186, 335, 165, 7)
drawfill (316, 185, 7, 7)
drawbox (265, 115, 285, 135, 7)
drawfill (266, 116, 7, 7)
drawbox (290, 160, 310, 140, 7)
drawfill (291, 159, 7, 7)
end if
if die3 = 6 then
drawbox (115, 186, 135, 165, 7)
drawfill (116, 185, 7, 7)
drawbox (185, 115, 165, 135, 7)
drawfill (184, 116, 7, 7)
drawbox (115, 115, 135, 135, 7)
drawfill (116, 116, 7, 7)
drawbox (165, 185, 185, 165, 7)
drawfill (166, 184, 7, 7)
drawbox (115, 140, 135, 160, 7)
drawfill (116, 141, 7, 7)
drawbox (185, 139, 165, 160, 7)
drawfill (184, 140, 7, 7)
end if
if die4 = 6 then
drawbox (265, 186, 285, 165, 7)
drawfill (266, 185, 7, 7)
drawbox (315, 115, 335, 135, 7)
drawfill (316, 116, 7, 7)
drawbox (315, 186, 335, 165, 7)
drawfill (316, 185, 7, 7)
drawbox (265, 115, 285, 135, 7)
drawfill (266, 116, 7, 7)
drawbox (265, 160, 285, 140, 7)
drawfill (266, 159, 7, 7)
drawbox (315, 160, 335, 140, 7)
drawfill (316, 159, 7, 7)
end if
end loop
















Archived topic from Iceteks, old topic ID:3057, old post ID:25052
Sockoo
Posts: 12
Joined: Tue Apr 12, 2005 5:51 pm

help with dice for turing

Post by Sockoo »

hmm neat lil program and what u'd have to do .. is make it soo when lets say the dice rolls a 1 you make a counter so dic1:= dic1+1 after ur loop of course .. and so on soo that at the end of the program .. i'll have lets say dic1:= 50 .. saying u rolled #1 50 times the chat .. is ez do that once you have everything counted for ..

Archived topic from Iceteks, old topic ID:3057, old post ID:26354
rip_phreaker
Posts: 34
Joined: Thu May 05, 2005 9:05 pm

help with dice for turing

Post by rip_phreaker »

u could prgram something like

var dic1array : array of int % dynamic array for all dice rolls

and then within the loop just put in a counter and go
dic1array (count) := dice roll % dice roll being the amount the dice rolled
also i would suggest after every dive roll place a "press any key to roll again"

procedure getKey
var ch : string (1)
getch (ch)
end getKey

and just place getKey after the put statement and an output to the screen after cls showing counter and the dice rolled

hope this might help ya out a bit

Archived topic from Iceteks, old topic ID:3057, old post ID:26733
Locked