Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- {You need a file named 'PROFILE.TXT' contains number 1000}
- Program Roll_The_Dice;
- Uses crt;
- Var
- Money, i, l: LongInt;
- f: Text;
- Age: Word;
- Name: String;
- Function Up(m: String): String;
- Begin
- For i:=1 to length(m) do
- Begin
- m[i]:=Upcase(m[i]);
- End;
- Up:=m;
- End;
- Procedure Set_up_screen;
- Begin
- TextBackGround(White);
- For i:=1 to 25 do
- Begin
- Write(' ');
- Writeln(' ');
- End;
- gotoxy(1,1);
- TextColor(Black);
- End;
- Procedure Welcome;
- Var
- Answer, St: String;
- n, m, RandX, RandY, RandString: Integer;
- Begin
- St:='YOUUUUUUUUUUUUUUUUUU!!!!!!';
- Writeln('Hey!'); Delay(1000);
- Writeln('Welcome to the casino in DOS!'); Delay(1000);
- Writeln('I''m Mr.Bot- your instructor'); Delay(1000);
- Writeln('Are you new here? '); Readln(Answer);
- While (Up(Answer)<>'YES') and (Up(Answer)<>'NO') and (Up(Answer)<>'666') and
- (Up(Answer)<>'USERNAME 666') do
- Begin
- Writeln('I don''t understand your command'); Delay(1000);
- Write('Say again pls :) : ');
- Readln(Answer);
- End;
- While Answer='Username 666' do
- Begin
- For i:=1 to 3 do
- Begin
- clrscr;
- Write('.'); Delay(750);
- Write('.'); Delay(750);
- Write('.'); Delay(750);
- clrscr;
- End;
- Write('I...'); Delay(1000);
- Write('I don''t know what...'); Delay(1000);
- Writeln('what are you talking about');
- Write('Say...'); Delay(1000); Write('Say again pls: ');
- Readln(Answer);
- End;
- If Answer='666' then
- Begin
- Clrscr;
- TextBackGround(Red);
- For i:=1 to 25 do
- Begin
- Write(' ');
- Writeln(' ');
- End;
- TextColor(LightRed);
- Gotoxy(1,1);
- Writeln('I''M '); Delay(1000); Writeln('GONNA.......'); Delay(1000);
- Write('K'); Delay(750); Write('I'); Delay(750);
- Write('L'); Delay(750); Write('L ');
- Delay(1000);
- For i:=1 to length(St) do
- Begin
- Write(St[i]); Delay(500);
- End;
- Delay(1000);
- Randomize;
- RandX:=25; RandY:=80;
- RandString:=8;
- For i:=1 to 40 do
- Begin
- n:=Random(RandX)+1;
- m:=Random(RandY)+1;
- Gotoxy(m,n);
- Case Random(RandString)+1 of
- 1: St:='DIE! DIE! DIE! DIE! DIE! DIE!';
- 2: St:='666 666 666 666';
- 3: St:='SL#!?ER M@N 1~ G01n% t0 K1*L Y&$';
- 4: St:='Mr.BOT is not so nice He is E@%?!';
- 5: St:='You discoverd it yet??? ';
- 6: St:='KILL...........';
- 7: St:='No one can escape';
- 8: St:='From@)#@(this@#@%? DOS';
- End;
- Write(St);
- Delay(300);
- End;
- Halt;
- End;
- If Answer='yes' then
- Begin
- Writeln('OK! Let''s make a profile for you so you can play here!');
- Write('Input your name: '); Readln(Name);
- Write('Input your age: '); Readln(Age);
- If Age<18 then
- Begin
- Writeln('Oops you aren''t old enough to join the casino'); Delay(1500);
- Writeln('I''m so sorry :('); Delay(1500);
- Writeln('Come back when you are old enough'); Delay(1500);
- Halt;
- End;
- Writeln('Ok! Here are your money: 1000$'); Delay(1000);
- Writeln('Press enter when you are ready');
- Readln;
- Assign(f,'PROFILE.TXT');
- Rewrite(f);
- Write(f,1000);
- Close(f);
- end;
- If Answer='no' then
- Begin
- Writeln('Ok! You gonna use the old profile!');
- Delay(1000);
- End;
- End;
- Procedure Cout(m: String);
- Begin
- Writeln(m);
- Delay(2000);
- End;
- Procedure Intro;
- Begin
- Cout('Here are the rules: ');
- Cout('There are you and "the house"');
- Cout('You choose the bet');
- Cout('The house will rolls 3 dices, so will you');
- Cout('If the number on your dices is higher, you will win and earn money!');
- Cout('Else, you will lose and lose money');
- Cout('How much will you earn or lose money is based on your bet');
- Write('Understood and ready? Press any key to play now! :D ');
- Repeat Until KeyPressed;
- End;
- Procedure Loading_Screen;
- Begin
- clrscr;
- Randomize;
- For i:=1 to random(2)+2 do
- Begin
- Write('Loading'); Delay(500);
- clrscr;
- Write('Loading.'); Delay(500);
- clrscr;
- Write('Loading..'); Delay(500);
- clrscr;
- Write('Loading...'); Delay(500);
- clrscr;
- End;
- End;
- Procedure Play;
- Var
- Rand, Dice1, Dice2, x, y, z: Byte;
- Bet, Result: LongInt;
- Ans: String;
- Begin
- clrscr;
- Randomize;
- Rand:=6;
- Assign(f,'PROFILE.TXT'); Reset(f);
- Read(f,Money);
- Close(f);
- Repeat
- Write('Choose your bet: '); Readln(Bet);
- While Bet>Money do
- Begin
- Cout('What?! The bet is higher then your money!');
- Write('We can let you do that! Pls choose again: ');
- Readln(Bet);
- End;
- Cout('OK! Let''s play!');
- clrscr;
- Writeln('The house is rolling the dice...');
- For i:=1 to 300 do
- Begin
- Dice1:=0; x:=Random(Rand)+1; y:=Random(Rand)+1; z:=Random(Rand)+1;
- Write(x,' '); Dice1:=Dice1+x;
- Write(y,' '); Dice1:=Dice1+y;
- Write(z,' '); Dice1:=Dice1+z;
- Gotoxy(1,2);
- Delay(10);
- End;
- Gotoxy(6,2);Writeln(' = ',Dice1);
- Delay(1000);
- Writeln('You are rolling the dice...');
- For i:=1 to 300 do
- Begin
- Dice2:=0; x:=Random(Rand)+1; y:=Random(Rand)+1; z:=Random(Rand)+1;
- Write(x,' '); Dice2:=Dice2+x;
- Write(y,' '); Dice2:=Dice2+y;
- Write(z,' '); Dice2:=Dice2+z;
- Gotoxy(1,4);
- Delay(10);
- End;
- Gotoxy(6,4); Writeln(' = ',Dice2);
- Writeln;
- Delay(500);
- If Dice1<Dice2 then
- Begin
- Cout('Congrats! you won!');
- Money:=Money+Bet*(Dice2-Dice1);
- Writeln('You earned ',Bet*(Dice2-Dice1)); Delay(1000);
- Writeln('Your money: ', Money); Delay(1000);
- End;
- If Dice1>Dice2 then
- Begin
- Cout('Ohhh! you lost!');
- Money:=Money-Bet*(Dice1-Dice2);
- Writeln('You lost ',abs(Bet*(Dice2-Dice1))); Delay(1000);
- If Money>0 then
- Begin
- Writeln('Your money: ', Money); Delay(1000);
- End
- else
- Begin
- Cout('You lost all of your money! :''(');
- Cout('I''m so sorry! Come back later! :(');
- Assign(f,'PROFILE.TXT');
- Rewrite(f);
- Write(f,1000);
- Close(f);
- Halt;
- End;
- End;
- If Dice1=Dice2 then
- Begin
- Cout('It''s a tie!');
- Cout('Your money won''t be changed.');
- Writeln('Your money: ',Money); Delay(1000);
- End;
- Write('Do you want to continue?? '); Readln(Ans);
- clrscr;
- Until Up(Ans)='NO';
- Assign(f,'PROFILE.TXT');
- Rewrite(f);
- Write(f,Money);
- Close(f);
- Cout('Ok! Thanks you so much for playing! :) ');
- Cout('Your profile have been saved!');
- Cout('Hope you gonna visit the DOS Casino again!');
- Cout('Good bye and wish you luck everytime! ');
- End;
- Begin
- clrscr;
- Set_Up_Screen;
- Welcome;
- Intro;
- Loading_Screen;
- Play;
- End.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement