1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186
| program arcade;
uses crt, keyboard;
type grille= ARRAY [1..3,1..3]of integer ;
Var b,nbre_vie,s:integer;
g:grille; score:integer;
procedure entree (var h,k,b : integer);
var a: TKeyEvent; e : string;
begin
InitKeyBoard();
a:= PollKeyEvent();
a:= GetKeyEvent;
a:=TranslateKeyEvent(a); e:=KeyEventToString(a);
if a<>0 then
begin
b:= 1 ;
if e='1' then
begin
h:=3;
k:=1;
end;
if e='2' then
begin
h:=3;
k:=2;
end;
if e='3' then
begin
h:=3;
k:=3;
end;
if e='4' then
begin
h:=2;
k:=1;
end;
if e='5' then
begin
h:=2;
k:=2;
end;
if e='6' then
begin
h:=2;
k:=3;
end;
if e='7' then
begin
h:=1;
k:=1;
end;
if e='8' then
begin
h:=1;
k:=2;
end;
if e='9' then
begin
h:=1;
k:=3;
end;
end;
if a = 0 then
b:=0 ;
DoneKeyBoard();
end;
procedure association (b:integer;tab : grille ; var s : integer);
var h,k : integer;
begin
if b = 1 then
entree(h,k,b);
s:=tab[h][k];
if b = 0 then
s:=0;
end;
procedure Comptage (var nbre_vie, score , s : Integer);
begin
if (s>0) and (s<801) then
score:=score+10;
if (s> 800) and (s<901) then
nbre_vie:=nbre_vie +1 ;
if ((s> 900) and ( s<1001)) or (s=0) then
nbre_vie:=nbre_vie -1;
end;
procedure initialisation( var gr:grille);
var i,j,h,k :integer ;
begin
Randomize;
i:= random(3)+1;
j:= random(3)+1;
for h:= 1 TO 3 DO
BEGIN
FOR k:=1 TO 3 do
begin
if (h<>i) or (k<>j) then
gr[h][k]:= 0 ;
if (h=i) and (k=j) then
gr[h][k]:= random(1000)+1;
write ( ' ', gr[h][k] ,' ');
end;
writeln;
writeln;
end;
end;
function gestiondifficulte ( score: integer):integer;
var temps: integer;
begin
if (score < 201) then
temps:= 3000;
if (score>200) and (score < 401) then
temps:= 2000 ;
if (score > 400) and (score < 551) then
temps:= 1500;
if (score> 550) and (score < 601) then
temps := 1000;
if score > 600 then
temps := 500;
gestiondifficulte:=temps;
end;
begin
score:=0;
nbre_vie:=300;
repeat
initialisation(g);
writeln('s = ', s);
writeln('score = ',score);
writeln (' nb de vies = ', nbre_vie);
association(b,g,s);
Comptage(nbre_vie,score,s);
delay(3000);
clrscr();
until nbre_vie=0 ;
writeln;
writeln (' Game Over');
end. |
Partager