Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- program project1;
- uses
- crt;
- var
- inc, rnd1 ,rnd2,jbc,sec, pris ,stats, bank, turn : integer;
- key,key1,key2,key3:char;
- procedure etc;
- begin
- writeln('Daily income: ',inc,' cash.');
- writeln('Bank: ',bank);
- writeln('--------------------------------------');
- end;
- procedure etc1;
- begin
- writeln('Starting day number ',turn,'.');
- writeln('Bank: ',bank);
- writeln('Prisoners: ',pris);
- writeln('Daily income: ',inc);
- writeln('Security level: ',sec);
- end;
- begin
- repeat
- sec := 0;
- jbc := 7;
- turn := 0;
- bank := 0;
- stats := 0;
- pris := 2;
- inc := 150;
- writeln('Hello and welcome to the JailBreak game made by Sami.');
- readln;
- writeln('Instructions: ');
- writeln('-Feed your prisoners day by day (if possible).');
- writeln('-If the unsatisfied prisoners count gets over 3 your');
- writeln('daily income will start to decrease.');
- writeln('-You can buy a new prisoner from Menu(M) or increase');
- writeln('the security system, thus decreasing canche of jailbreak');
- writeln('If you get -300 cash you will lose the game.');
- writeln('The goal of the game is to have 5 prisoners in less days.');
- readln;
- writeln('Ready to play?[press <ENTER> to start the first day.]');
- readln;
- {-Starting the routine-}
- begin
- repeat
- randomize;
- rnd1 := random(3);
- rnd2 := random(jbc);
- if (rnd1 = 1) then begin
- clrscr;
- turn := turn + 1;
- etc1;
- repeat
- write(pris,' prisoners are hungry. Feed them? (Y/N): ');
- readln(key);
- key := upcase(key);
- until (key = 'Y') or (key = 'N');
- if (key = 'N') then begin
- stats := stats - 2;
- writeln('--------------------------------------');
- writeln('The prisoners are not satisfied for today!');
- writeln('Unsatisfied prisoners count: ',stats);
- end;
- if (key = 'Y') then begin
- stats := stats + 2;
- writeln('--------------------------------------');
- writeln('Good job! the prisoners are fullfiled for today!');
- bank := bank - 150;
- writeln('-150 cash');
- writeln('Satisfied prisoners count: ',stats);
- bank := bank + inc;
- etc;
- end;
- end;
- if (rnd1 = 2) then begin
- turn := turn + 1;
- clrscr;
- etc1;
- repeat
- write(pris-1,' prisoner is hungry. Feed him? (Y/N): ');
- readln(key);
- key := upcase(key);
- until (key = 'Y') or (key = 'N');
- if (key = 'N') then begin
- stats := stats - 1;
- writeln('--------------------------------------');
- writeln('The prisoner is not satisfied for today!');
- writeln('Unsatisfied prisoners count: ',stats);
- end;
- if (key = 'Y') then begin
- stats := stats + 1;
- writeln('--------------------------------------');
- writeln('Good job! the prisoners are fullfiled for today!');
- bank := bank - 100;
- writeln('-100 cash');
- writeln('Satisfied prisoners count: ',stats);
- bank := bank + inc;
- etc;
- end;
- end;
- if (rnd1 = 3) then begin
- turn := turn + 1;
- clrscr;
- etc1;
- writeln('--------------------------------------');
- write('No prisoner is hungry today, you are lucky!');
- bank := bank + inc;
- etc;
- end;
- {-Ending the routine-}
- {--------------------}
- {-Deciding either -inc or staying the same-}
- if (stats < -3) then begin
- writeln('The prisoners are very unsatisfied , income - 25');
- inc := inc - 25;
- end;
- if (stats > -3) then begin
- inc := 150;
- end;
- {ending -inc routine}
- {-----------------------}
- {starting final question before next day}
- begin
- repeat
- key2 := ' ';
- key3 := ' ';
- writeln('Continue(C) or Menu(M)? : ');
- readln(key2);
- key2 := upcase(key2);
- until (key2 = 'C') or (key2 = 'M');
- {choice to continue or menu}
- if (key2 = 'M') then begin
- repeat
- writeln('You entered the Menu, what you wish to do?');
- writeln('--------------------------');
- writeln('(B)uy new prisoner (-300 cash);');
- writeln('(I)ncrease security (- 200 cash);');
- writeln('(C)ontinue ( = cash);');
- readln(key3);
- key3 := upcase(key3);
- until (key3 = 'B') or (key3 = 'I') or (key3 = 'C');
- end;
- end;
- {ending menu choice}
- {starting custom choice}
- if (key3 = 'B') then begin
- writeln('You have bought a new prisoner!');
- writeln('-300 cash');
- writeln('Income : + 50');
- inc := inc + 50;
- bank := bank - 300;
- readln;
- end;
- if (key3 = 'I') then begin
- writeln('Security system upgraded, canche of escape decreased');
- writeln('-200 cash');
- bank := bank - 200;
- jbc := jbc + 2;
- sec := sec + 1;
- readln;
- end;
- {ending custom choice}
- {end day}
- {chance of escape at night}
- if (rnd2 = 1) then begin
- writeln('Bad Luck!One of your prisoner escaped!');
- pris := pris - 1;
- inc := inc - 50;
- readln;
- end;
- {end canche}
- until (pris = 5) or (bank < -300) or (pris = 0);
- if pris = 0 then begin
- writeln('You have no more prisoners, sorry, you lost the game!');
- end;
- if pris = 5 then begin
- writeln('Congratulations! You won the game in ',turn,' days with 5 prisoners!');
- end;
- if bank < -300 then
- writeln('Sorry, you lost the game (< -300 cash)');
- end;
- repeat
- writeln('Play again? (Y/N): ');
- readln(key1);
- key1 := upcase(key1);
- until (key = 'Y') or (key = 'N');
- until (key = 'N');
- end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement