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
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
| Program Sme;
uses crt;
type
reca=record
name:string[10];
resultat:integer;
end;
var
aa:reca;
Xz,Yz:array [1..40] of byte;
us:array [1..11] of reca;
i,j,a,k,k2,kk,och,z:integer;
H,W,hl,hr,Ww,Wn,PlayE,Play:ShortInt;
X1,Y1,x,y,d:byte;
Kno,onk:Char;
SL,Schot:Word;
Ax,Ay,Bx,By,Ex,Ey,as,sa:Byte;
f1:text;
f2:file of integer;
f3:text;
f4:text;
namen:string[10];
resul:string[20];
prav:string;
q,wq,qq,qw:string[15];
Procedure stolknovenie;
begin
for i:=2 to d-2 do
begin
if (Xz[i]=Xz[i+2]) and (Yz[i]=Yz[i+2]) then
as:=0 else as:=1;
sa:=sa*as;
end;
for i:=1 to d-3 do
begin
if (sa<>0) and (xz[1]=xz[i+3]) and (yz[1]=yz[i+3]) then Play:=0;
end;
if (Xz[1]=3) or (Xz[1]=57) or (Yz[1]=3) or (Yz[1]=22) Then Play:=0;
end;
Procedure Ramka(Xr,Yr:Byte; tt: string; c:byte);
begin
TextColor(c);
GotoXY (Xr,Yr+1);
write (tt);
For i:=Xr to Xr+20 do
begin
GotoXY (i,Yr);
write ('*');
GotoXY (i,Yr+2);
write ('*');
end;
For i:=Yr to Yr+2 do
begin
GotoXY (Xr,i);
write ('*');
GotoXY (Xr+20,i);
write ('*');
end;
end;
Procedure Izm(vv:byte);
Begin
Ax:=Bx; Ay:=By;
Bx:=Xz[vv]; By:=Yz[vv];
Xz[vv]:=Ax; Yz[vv]:=Ay;
End;
Procedure menu2 (q,qq,wq,qw:string);
begin
Clrscr;
TextBackground (0);
TextColor (15);
For X1:=25 to 55 do
Begin
GotoXY (X1,4);
Write ('*');
GotoXY (X1,22);
Write ('*');
end;
For Y1:=4 to 22 do
begin
GotoXY (25,Y1);
Write ('*');
GotoXY (55,Y1);
Write ('*');
end;
GotoXY (31,7);
Write (q);
K2:=0;
repeat
K2:=k2+kk;
kk:=0;
If k2=0 Then Ramka (30,10,qq,128) else
Ramka (30,10,qq,15);
If k2=1 then Ramka (30,14,wq,128) else
Ramka (30,14,wq,15);
IF K2=2 Then Ramka (30,18,qw,128) else
Ramka (30,18,qw,15);
Kno:=ReadKey;
If Kno=#80 then Begin if k2<2 then kk:=1 else kk:=0; end else
if Kno=#72 then Begin if k2>0 then kk:=-1 else kk:=0; end;
until Kno=chr(13);
end;
Procedure Spravka;
begin
menu2(' СПРАВКА',' ПРАВИЛА ИГРЫ ',' РАЗРАБОТЧИК ',' НАЗАД ');
if k2=0 then
begin
clrscr;
assign(f4,'d:\kkk\pravila.pas');
reset(f4);
i:=3;
While not EOF(f4) do
begin
GotoXY(3,i);
i:=i+2;
readln(f4,prav);
writeln(prav);
end;
readln;
end;
if k2=1 then
begin
clrscr;
TextBackground(0);
TextColor (4);
For X1:=3 to 77 do
Begin
GotoXY (x1,2);
Write ('*');
GotoXY (X1,23);
write ('*');
end;
For Y1:=2 to 23 do
Begin
GotoXY (3,Y1);
Write ('*');
GotoXY (77,y1);
Write ('*');
end;
assign(f4,'d:\kkk\avtor.pas');
reset(f4);
d:=7;
While not EOF (f4) do
begin
textcolor(10);
readln(f4,prav);
GotoXY (19,d);
Write (prav);
d:=d+2;
for i:=1 to 4 do
Delay (59000);
end;
close(f4);
readln;
end;
if k2=2 then
TextBackground (0);
textcolor(15);
end;
Procedure Resultat;
begin
clrscr;
reset(f1);
for i:=1 to 10 do
begin
readln(f1,us[i].name);
end;
close(f1);
reset(f2);
for i:=1 to 10 do
read(f2,us[i].resultat);
close(f2);
gotoXy(25,12);
If schot>us[10].resultat then
begin
writeln('Ваш результат составил: ', schot);
gotoxy(30,13);
writeln('Введите ваше имя...');
gotoxy(36,14);
read(namen);
end
else
begin
GotoXY(23,13);
writeln('Вы не побили самый худший результат!!! :(');
GotoXY(13,14);
writeln('Но не огорчайтесь!!! Вы можете просто написать ваше имя!!!)))');
GotoXY(36,15);
readln(namen);
end;
us[11].name:=namen;
us[11].resultat:=schot;
for i:=1 to 11 do
for j:=2 to 11 do
begin
if us[j].resultat>us[j-1].resultat then
begin
aa:=us[j-1];
us[j-1]:=us[j];
us[j]:=aa;
end;
end;
rewrite(f1);
for i:=1 to 10 do
begin
write(f1,us[i].name);
writeln(f1,' ');
end;
close(f1);
rewrite(f2);
for i:=1 to 10 do
write(f2,us[i].resultat);
close(f2);
rewrite(f3);
for i:=1 to 10 do
writeln(f3,i,': ',us[i].resultat,' ',us[i].name);
close(f3);
end;
begin
assign (f3,'d:\kkk\itog.txt');
assign (f1,'d:\kkk\imena.txt');
assign (f2,'d:\kkk\rec.dat');
repeat
repeat
Clrscr;
TextBackground (0);
TextColor (15);
For X1:=25 to 55 do
Begin
GotoXY (X1,4);
Write ('*');
GotoXY (X1,22);
Write ('*');
end;
For Y1:=4 to 22 do
begin
GotoXY (25,Y1);
Write ('*');
GotoXY (55,Y1);
Write ('*');
end;
K:=0;
Repeat
k:=k+kk;
kk:=0;
If k=0 Then Ramka (30,6,' ИГРАТЬ ',128) else
Ramka (30,6,' ИГРАТЬ ',15);
If k=1 Then Ramka (30,10,' РЕКОРДЫ ',128) else
Ramka (30,10,' РЕКОРДЫ ',15);
If k=2 then Ramka (30,14,' СПРАВКА ',128) else
Ramka (30,14,' СПРАВКА ',15);
If k=3 then Ramka (30,18,' ВЫХОД ',128) else
Ramka (30,18,' ВЫХОД ',15);
Kno:=ReadKey;
If Kno=#80 then Begin if k<3 then kk:=1 else kk:=0; end else
if Kno=#72 then Begin if k>0 then kk:=-1 else kk:=0; end;
until Kno=chr(13);
If k=1 then
begin
Clrscr;
GotoXy(36,5);
writeln('РЕКОРДЫ');
reset (f3);
for i:=1 to 10 do
begin
readln(f3,resul);
GotoXY (32,7+i);
Write(resul);
end;
close(f3);
Readln;
end;
If k=2 then
repeat
spravka;
until k2=2;
If k=3 then
exit;
until (k=3) or (k=0);
If k=0 then begin
menu2 (' УРОВЕНЬ СЛОЖНОСТИ',' ГЛИСТ ',' ЗМЕЯ ',' АНАКОНДА ');
end;
If K2=0 then begin Sl:=40000; och:=25; d:=5 end else if k2=1 then begin
Sl:=30000; och:=50; d:=10 end else begin Sl:=20000; och:=100; d:=15 end;
TextBackground (1);
Textcolor (5);
clrscr;
schot:=0; playE:=1;
Xz[1]:=30;
Yz[1]:=13;
For i:=2 to 40 do
begin
Xz[i]:=Xz[1];
Yz[i]:=Yz[1];
end;
For X1:=3 to 57 do
Begin
GotoXY (x1,2);
Write ('*');
GotoXY (X1,23);
write ('*');
end;
For Y1:=2 to 23 do
Begin
GotoXY (3,Y1);
Write ('*');
GotoXY (57,y1);
Write ('*');
end;
Play:=1;
GotoXY(60,4);
write('СЧЕТ: ');
GotoXY(60,6);
write('Рост змеи: ');
gotoXY(60,8);
write('Лучшие результаты:');
reset(f3);
for i:=1 to 3 do
begin
readln(f3,resul);
GotoXY (60,9+i);
Write(resul);
end;
close(f3);
Repeat
If play=1 then begin
TextColor (4);
Ax:=xz[1]; Ay:=Yz[1];
Xz[1]:=Xz[1]+H; Yz[1]:=Yz[1]+W;
Bx:=Xz[2]; By:=Yz[2];
Xz[2]:=Ax; Yz[2]:=Ay;
For i:=3 to 40 do
izm(i);
GotoXY (Xz[1],Yz[1]);
write(chr(1));
For i:=2 to d do
begin
GotoXY (Xz[i],Yz[i]);
Write(chr(4));
end;
Delay(SL);
Textcolor (1);
GotoXY (Xz[1],Yz[1]);
write(chr(1));
For i:=2 to 40 do
begin
GotoXY (Xz[i],Yz[i]);
Write(chr(4));
end;
randomize;
if PlayE=1 then
begin
Ex:=Random(54)+4;
Ey:=random(18)+4;
If (K2=0) and (schot<>0) and ((schot mod 75)=0) then
d:=d+1;
if (k2=0) and (schot<>0) and ((schot mod 150)=0) then
Sl:=Sl-500;
If (K2=1) and (schot<>0) and ((schot mod 150)=0) then
d:=d+1;
if (k2=1) and (schot<>0) and ((schot mod 500)=0) then
Sl:=Sl-500;
If (K2=2) and (schot<>0) and ((schot mod 500)=0) then
d:=d+1;
if (k2=2) and (schot<>0) and ((schot mod 1000)=0) then
Sl:=Sl-500;
PlayE:=0; end;
Textcolor (6);
GotoXY(Ex,Ey);
write(chr(6));
if (Xz[1]=Ex) and (Yz[1]=Ey) then
begin
schot:=schot+och;
PlayE:=1;
Textcolor (1);
GotoXy(Ex,Ey);
write (' ');
end;
Case Kno of
#72: Begin W:=-1; H:=0; end;
#80: Begin W:=1; H:=0; end;
#77: Begin W:=0; H:=1; end;
#75: Begin W:=0; h:=-1; end;
end;
If Keypressed=true then begin onk:=readkey;Kno:=Readkey; end;
end;
GotoXY(66,4);
write(Schot);
GotoXY(70,6);
write(d);
sa:=10;
stolknovenie;
until Play=0;
If play=0 then begin
TextBackground (0);
Textcolor (15);
clrscr;
GotoXY(6,8);
write(' ***** ***** * * ******* ***** ** ** ******* ****** ');
GotoXY(6,9);
write('******* ******* ** ** ******* ******* ** ** ******* *******');
GotoXY(6,10);
write('** ** ** *** *** ** ** ** ** ** ** ** **');
GotoXY(6,11);
write('** ** ** **** **** ** ** ** ** ** ** ** **');
GotoXY(6,12);
write('** ** ** ** *** ** **** ** ** ** ** **** ** **');
GotoXY(6,13);
write('** ** ******* ** * ** **** ** ** ** ** **** ****** ');
GotoXY(6,14);
write('** *** ******* ** ** ** ** ** ** ** ** **** ');
GotoXY(6,15);
write('** ** ** ** ** ** ** ** ** ** ** ** ** ** ');
GotoXY(6,16);
write('******* ** ** ** ** ******* ******* *** ******* ** ** ');
GotoXY(6,17);
write(' ***** ** ** ** ** ******* ***** * ******* ** **');
GotoXY(25,23);
Write('Для продолжения нажмите ENTER');
repeat
kno:=readkey;
until Kno=chr(13);
end;
resultat;
H:=0; w:=0; k:=0; kk:=0;
until k=3; end. |