Jacobdm0
2007-08-09 21:44:30
not my first script, (like my 5th or 6th) but it's still a very begginer script.
Here it is:
not really that great…but still kinda fun!
*UPDATED* Much better version, cuts out actually writing heads and tails, and gives you immediate results.
Here it is:
program CoinFlip;
//SETUP\\
const
Howmanyflips = 100; //how many coin flips to do.
Howlongtowait = 0; //how many miliseconds to wait between each flip.
//END OF SETUP\\
var
i : integer;
Heads : integer;
Tails : integer;
procedure
Count;
Begin
i:= i+1;
case Random (2) of
0: begin
Heads:= Heads+1
end
1: begin
Tails:= Tails+1
end;
end;
end;
Procedure
ProgReport;
begin
Writeln('==================');
Writeln(' Tails : ' +IntToStr(Tails));
Writeln(' Heads : ' +IntToStr(Heads));
Writeln('==================');
end;
begin
i:= 0;
repeat
begin
Count;
Wait(howlongtowait);
end
until (i = howmanyflips);
ProgReport;
end.not really that great…but still kinda fun!
*UPDATED* Much better version, cuts out actually writing heads and tails, and gives you immediate results.