smithsps
2008-03-29 21:58:33
Heres a script I just made for fun. :D
It just simulates flipping a a set amount of times.
Dice Roller
Card Picker
It just simulates flipping a a set amount of times.
program CoinFlipper;
const
TW = 100000; //Times to flip coin.
var
H, T, TD, TempWait : integer;
Procedure Report;
begin
ClearDebug;
writeln('{}---------- Coin Flipper ----------{}');
writeln(Padr('{}- Times Flipped: '+ IntToStr(TD), 36)+ '-{}');
writeln('{}-----------------------------------{}');
writeln(Padr('{}- Landed on Heads: '+ IntToStr(H), 36)+ '-{}');
writeln(Padr('{}- Landed on Tails: '+ IntToStr(T), 36)+ '-{}');
writeln('{}-----------------------------------{}');
end;
Procedure SemiReport;
begin
ClearDebug;
writeln('{}-------------- Coin Flipper --------------{}');
writeln(Padr('{}-- Times Flipped: '+ IntToStr(TD)+ ' out of '+ IntToStr(TW), 43)+ '--{}');
writeln('{}-------------------------------------------{}');
end;
Function CWait(Amount : integer): integer;
begin //Used to speed up script.
if (Amount <= 100000) then Result := 10;
if (Amount >= 100000) then Result := 100;
if (Amount >= 1000000) then Result := 1000;
end;
Procedure TWait;
begin
wait(1);
SemiReport;
TempWait := 0;
end;
Procedure HorT;
begin
if (TempWait = CWait(TW)) then TWait;
case Random(2) of
0: H := H + 1;
1: T := T + 1;
end;
TempWait := TempWait + 1;
TD := TD + 1;
end;
begin
ClearDebug;
while TW > TD do HorT;
Report;
end.Dice Roller
program DiceRoller;
const
TimesToRoll = 185;//Times to roll Dice
var
TimesRolled, TempWait : integer;
One, Two, Thr, Fou, Fiv, Six : integer;
Procedure Report;
begin
ClearDebug;
writeln('{}----------- Dice Roller -----------{}');
writeln(Padr('{}- Times Rolled: '+ IntToStr(TimesRolled), 36)+ '-{}');
writeln('{}-----------------------------------{}');
writeln(Padr('{}- Landed on One: '+ IntToStr(One), 36)+ '-{}');
writeln(Padr('{}- Landed on Two: '+ IntToStr(Two), 36)+ '-{}');
writeln(Padr('{}- Landed on Three: '+ IntToStr(Thr), 36)+ '-{}');
writeln(Padr('{}- Landed on Four: '+ IntToStr(Fou), 36)+ '-{}');
writeln(Padr('{}- Landed on Five: '+ IntToStr(Fiv), 36)+ '-{}');
writeln(Padr('{}- Landed on Six: '+ IntToStr(Six), 36)+ '-{}');
writeln('{}-----------------------------------{}');
end;
Procedure SemiReport;
begin
ClearDebug;
writeln('{}--------------- Dice Roller ---------------{}');
writeln(Padr('{}-- Times Flipped: '+ IntToStr(TimesRolled)+ ' out of '+ IntToStr(TimesToRoll), 43)+ '--{}');
writeln('{}-------------------------------------------{}');
end;
Function CWait(Amount : integer): integer;
begin //Used to speed up script.
if (TimesToRoll <= 100000) then Result := 10;
if (TimesToRoll >= 100000) then Result := 100;
if (TimesToRoll >= 1000000) then Result := 1000;
end;
Procedure TWait;
begin
wait(1);
SemiReport;
TempWait := 0;
end;
Procedure Roll;
begin
if (TempWait = CWait(TimesToRoll)) then TWait;
case Random(6) of
0: One := One + 1;
1: Two := Two + 1;
2: Thr := Thr + 1;
3: Fou := Fou + 1;
4: Fiv := Fiv + 1;
5: Six := Six + 1;
end;
TimesRolled := TimesRolled + 1;
TempWait := TempWait + 1;
end;
begin
ClearDebug;
while (TimesToRoll > TimesRolled) do Roll;
Report;
end.Card Picker
program CardGiver;
const
HowManyCards = 2;//How many cards you want
var
CardsPicked : integer;
Procedure PickCard;
begin
case Random(52) of
0: writeln('Ace of Spades');
1: writeln('Two of Spades');
2: writeln('Three of Spades');
3: writeln('Four of Spades');
4: writeln('Five of Spades');
5: writeln('Six of Spades');
6: writeln('Seven of Spades');
7: writeln('Eight of Spades');
8: writeln('Nine of Spades');
9: writeln('Ten of Spades');
10: writeln('Jack of Spades');
11: writeln('Queen of Spades');
12: writeln('King of Spades');
13: writeln('Ace of Clubs');
14: writeln('Two of Clubs');
15: writeln('Three of Clubs');
16: writeln('Four of Clubs');
17: writeln('Five of Clubs');
18: writeln('Six of Clubs');
19: writeln('Seven of Clubs');
20: writeln('Eight of Clubs');
21: writeln('Nine of Clubs');
22: writeln('Ten of Clubs');
23: writeln('Jack of Clubs');
24: writeln('Queen of Clubs');
25: writeln('King of Clubs');
26: writeln('Ace of Hearts');
27: writeln('Two of Hearts');
28: writeln('Three of Hearts');
29: writeln('Four of Hearts');
30: writeln('Five of Hearts');
31: writeln('Six of Hearts');
32: writeln('Seven of Hearts');
33: writeln('Eight of Hearts');
34: writeln('Nine of Hearts');
35: writeln('Ten of Hearts');
36: writeln('Jack of Hearts');
37: writeln('Queen of Hearts');
38: writeln('King of Hearts');
39: writeln('Ace of Diamonds');
40: writeln('Two of Diamonds');
41: writeln('Three of Diamonds');
42: writeln('Four of Diamonds');
43: writeln('Five of Diamonds');
44: writeln('Six of Diamonds');
45: writeln('Seven of Diamonds');
46: writeln('Eight of Diamonds');
47: writeln('Nine of Diamonds');
48: writeln('Ten of Diamonds');
49: writeln('Jack of Diamonds');
50: writeln('Queen of Diamonds');
51: writeln('King of Diamonds');
end;
CardsPicked := CardsPicked + 1;
end;
begin
ClearDebug;
while (HowManyCards > CardsPicked) do PickCard;
end.