DEMOMODE.PAS 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722
  1. Uses CRT,Graph,DOS;
  2. Type Hiscore = record
  3. Name : array[1..10] of string[16];
  4. Score : array[1..10] of Word;
  5. Sp : byte;
  6. end;
  7. Var
  8. test : boolean;
  9. now, cl : byte;
  10. rcrd : boolean;
  11. s : SearchRec;
  12. Tbl : file of HiScore;
  13. MAX : HiScore;
  14. col : integer;
  15. C : char;
  16. lt, rt : Byte;
  17. W, e : word;
  18. Dir, b : byte;
  19. Num : longint;
  20. en : array [1..2] of byte;
  21. bg : array [1..2] of byte;
  22. a : array [20..80, 2..25] of integer;
  23. i,j,k,l,r : byte;
  24. {-----------------======================-----------------}
  25. Procedure FullClnBuf;forward;
  26. Procedure ClnBuf;forward;
  27. Procedure Setup; forward;
  28. Procedure Stat1(bg1,bg2:byte); forward;
  29. Procedure Apple ; forward;
  30. Procedure Ext ; forward;
  31. Procedure StartUp; forward;
  32. Procedure DrawTable; forward;
  33. Procedure Game; forward;
  34. {---------------------------------------------------------}
  35. Function Last(n:word):integer;
  36. Var p,o : byte;
  37. Begin
  38. for p := WhereY-3 to WhereY+3 do
  39. for o := Wherex - 3 to WhereX + 3 do
  40. if a[o,p] = n + 1 then
  41. Last := p * 100 + o;
  42. end;{last}
  43. {---------------------------------------------------------}
  44. Function TestPos(s : byte):boolean;
  45. Begin
  46. TestPos := true;
  47. if s <> 1 then begin
  48. case dir of
  49. 1 : begin
  50. if (WhereX+1 > 79) then TestPos := false;
  51. if a[WhereX,WhereY] > num then TestPos := false
  52. else if a[WhereX+1,WhereY] > num then TestPos := false;
  53. If (a[WhereX+1, WhereY - 1]>0) and (a[WhereX+1, WhereY+1]>0) then
  54. TestPos := false;
  55. end;
  56. 2: begin
  57. if (WhereY + 2) > 23 then TestPos := false;
  58. if a[WhereX-1,WhereY+2] > num then TestPos := false
  59. else if a[WhereX-1,WhereY+1] > num then TestPos := false;
  60. If (a[WhereX, WhereY + 2]>0) and (a[WhereX-2, WhereY+2]>0) then
  61. TestPos := false;
  62. end;
  63. 3 : begin
  64. if (WhereX-3) < 21 then TestPos := false;
  65. if a[WhereX-3,WhereY] > num then TestPos := false
  66. else if a[WhereX-2,WhereY] > num then TestPos := false;
  67. If (a[WhereX-3, WhereY -1]>0) and (a[WhereX-3, WhereY+1]>0) then
  68. TestPos := false;
  69. end;
  70. 4 : begin
  71. if (WhereY - 2) < 3 then TestPos := false;
  72. if a[WhereX-1,WhereY-2] > num then TestPos := False
  73. else if a[WhereX-1,WhereY-1] > num then TestPos := False;
  74. If (a[WhereX, WhereY - 2]>0) and (a[WhereX-2, WhereY-2]>0) then
  75. TestPos := false;
  76. end;
  77. end;
  78. end
  79. else
  80. begin
  81. case w of
  82. 77 : case dir of
  83. 1 : begin
  84. if WhereX > 79 then testPos := false;
  85. if a[whereX,WhereY+1] > 0 then testPos := false;
  86. if a[whereX,WhereY] > 0 then testPos := false;
  87. end;
  88. 2 : begin
  89. if (WhereY + 1) > 23 then testPos := false;
  90. if a[whereX-2,WhereY+1] > 0 then testPos := false;
  91. if a[whereX-1,WhereY+1] > 0 then testPos := false;
  92. end;
  93. 3 : begin
  94. if (WhereX - 2) < 21 then testPos := false;;
  95. if a[whereX-2,WhereY-1] > 0 then testPos := false;
  96. if a[whereX-2,WhereY] > 0 then testPos := false;
  97. end;
  98. 4 : begin
  99. if (WhereY - 1) < 3 then testPos := false;;
  100. if a[whereX,WhereY-1] > 0 then testPos := false;
  101. if a[whereX-1,WhereY+1] > 0 then testPos := false;
  102. end;
  103. end;
  104. 75 : case dir of
  105. 1 : begin
  106. if WhereX > 79 then testPos := false;
  107. if a[whereX,WhereY-1] > 0 then testPos := false;
  108. if a[whereX,WhereY] > 0 then testPos := false;
  109. end;
  110. 2 : begin
  111. if WhereY + 1 > 23 then testPos := false;
  112. if a[whereX,WhereY+1] > 0 then testPos := false;;
  113. if a[whereX-1,WhereY+1] > 0 then testPos := false;
  114. end;
  115. 3 : begin
  116. if WhereX - 2 < 21 then testPos := false;
  117. if a[whereX-2,WhereY+1] > 0 then testPos := false;;
  118. if a[whereX-2,WhereY] > 0 then testPos := false;
  119. end;
  120. 4 : begin
  121. if WhereY - 1 < 3 then testPos := false;
  122. if a[whereX-2,WhereY-1] > 0 then testPos := false;;
  123. if a[whereX-1,WhereY-1] > 0 then testPos := false;
  124. end;
  125. end;
  126. end;
  127. end;
  128. end;{TestPos}
  129. {-------------------------------------------------------}
  130. Procedure AI;
  131. Var
  132. s,y : byte;
  133. begin
  134. for y := 20 to 80 do
  135. begin
  136. a[y,2] := 32000;
  137. a[y,24] := 32000;
  138. end;
  139. for y := 2 to 24 do
  140. begin
  141. a[20,y] := 32000;
  142. a[80,y] := 32000;
  143. end;
  144. randomize;
  145. repeat
  146. repeat
  147. s := random(3);
  148. until s <> 0;
  149. if s = 1 then
  150. begin
  151. repeat
  152. w := random(78);
  153. c := #0;
  154. until (w = 77) or (w = 75);
  155. end
  156. else
  157. begin
  158. Fullclnbuf;
  159. c := #24;
  160. w := 12;
  161. end;
  162. until TestPos(s);
  163. end;{AI}
  164. {-----------------------------------------------------}
  165. Procedure ClnBuf;
  166. var
  167. z : char;
  168. v : byte;
  169. p : boolean;
  170. begin
  171. p := false;
  172. c := #1;
  173. w := 0;
  174. Repeat
  175. if KeyPressed then
  176. z := ReadKey;
  177. if z = #0 then v := ord(readKey);
  178. if (v = 77) or (z = #27) or (z = 'p') or (z = 'P') or (v = 75) then
  179. begin
  180. p := true;
  181. c := z;
  182. w := v;
  183. end;
  184. if p then exit;
  185. until not keypressed;
  186. end;{clnbuf}
  187. {---------------------------------------------------------}
  188. Procedure FullClnBuf;
  189. begin
  190. Repeat
  191. if KeyPressed then
  192. ReadKey;
  193. until not keypressed;
  194. end;{clnbuf}
  195. {----------------------------------------------------------}
  196. Procedure Recrd(i : byte);
  197. Var t : byte;
  198. Begin
  199. t := 0;
  200. if rcrd then begin
  201. ClrScr;
  202. GotoXY(30,10);
  203. if i = 10 then max.score[10] := col
  204. else
  205. for t := 9 downto i do begin
  206. max.score[t+1] := max.score[t];
  207. max.name[t+1] := max.name[t]
  208. end;
  209. max.score[i] := col;
  210. TextColor(cyan);
  211. Write('П О З Д Р А В Л Я Ю');
  212. GotoXY(30,12);
  213. TextColor(Blue);
  214. Write('Вы поставили рекорд');
  215. GotoXY(12,17);
  216. TextColor(Yellow);
  217. Write('Введите свое имя до 20 символов ');
  218. TextColor(lightgreen);
  219. Readln(max.name[i]);
  220. TextColor(7);
  221. Seek(tbl,0);
  222. Write(tbl,max);
  223. Close(tbl);
  224. Reset(tbl);
  225. end;
  226. end;{Recrd}
  227. {-----------------------------------------------------------}
  228. Procedure SetCursorSize(size:word);
  229. var
  230. reg : registers;
  231. begin
  232. with reg do begin
  233. AH := $01;
  234. CH := hi(size);
  235. CL := lo(size);
  236. Intr($10,reg);
  237. end;
  238. end;
  239. {------------------------------------------------------------}
  240. Procedure Setup;
  241. begin
  242. CloseGraph;
  243. ClrScr;
  244. TextMode(CO80);
  245. SetCursorSize(16*256);
  246. GotoXY(10, 5);
  247. Write('1 : Скорость');
  248. {GotoXY(10, 10);
  249. Write('2 : Установить Клавиши');}
  250. GotoXY(10, 15);
  251. Write('3 : Завершить настроики');
  252. GotoXY(1,1);
  253. Case readkey of
  254. '1' : begin
  255. GotoXY(12,20);
  256. Write('Введите скорость 1..10 (5) ');
  257. repeat
  258. Readln(max.sp);
  259. until (max.sp > 0) and (max.sp < 11);
  260. end;
  261. '2' : begin
  262. end;
  263. end;
  264. end;{setup}
  265. {--------------------------------------------------------}
  266. Procedure Stat1;
  267. begin
  268. TextColor(Yellow);
  269. GotoXY(15,3);
  270. Write(' ');
  271. GotoXY(15,3);
  272. Write(bg1-21);
  273. GotoXY(15,5);
  274. Write(' ');
  275. GotoXY(15,5);
  276. Write(bg2-2);
  277. GotoXY(15,7);
  278. Write(col);
  279. GotoXY(15,9);
  280. Write(num);
  281. GotoXY(bg1,bg2);
  282. TextColor(cl);
  283. end; {stat}
  284. {--------------------------------------------------------}
  285. Procedure StatMain;
  286. Var n,k : byte;
  287. begin
  288. N := 0;
  289. DrawTable;
  290. TextColor(Yellow);
  291. GotoXY(1,3);
  292. Write('X : ');
  293. GotoXY(1,5);
  294. Write('Y : ');
  295. GotoXY(1,7);
  296. Write('Длина змея : ');
  297. GotoXY(1,9);
  298. Write('Число ходов : ');
  299. GotoXY(7,12);
  300. TextColor(LightBlue);
  301. Write('Лучшие ');
  302. TextColor(LightGreen);
  303. for n := 1 to 10 do begin
  304. GotoXY(2,13 + n);
  305. Write(max.name[n], Max.score[n]:(17 - length(max.name[n])));
  306. end;
  307. for n := 3 to 24 do
  308. for k := 21 to 79 do
  309. a[k,n] := 0;
  310. end; {StatMain}
  311. {------------------------------------------------}
  312. Procedure Apple;
  313. Var i,j,c,b1,b2 : byte;
  314. begin
  315. randomize;
  316. cl := now;
  317. repeat
  318. i := random(78);
  319. j := random(23);
  320. c := random(9);
  321. r := random(14);
  322. until (i > 20) and (i < 80) and (j > 2 ) and (j < 25)
  323. and (c <> 0) and (a[i,j] = 0) and (r <> 0) and (r <> 7) and (r <> cl);
  324. b1 := WhereX;
  325. b2 := WhereY;
  326. GotoXY(i,j);
  327. TextColor(r);
  328. Now := r;
  329. Write(c);
  330. TextColor(cl);
  331. a[i,j] := - c;
  332. now := r;
  333. GotoXY(b1,b2);
  334. end;
  335. {-------------------------------------------------------}
  336. Procedure Ext;
  337. var
  338. Gd, Gm :integer;
  339. h : char;
  340. k : byte;
  341. begin
  342. Sound(100);
  343. Delay(2000);
  344. Nosound;
  345. Rcrd := true;
  346. For k := 1 to 10 do
  347. if col > max.score[k] then begin
  348. Recrd(k);
  349. rcrd := false;
  350. end;
  351. FullClnbuf;
  352. Gd := Detect;
  353. InitGraph(Gd, Gm, '');
  354. if GraphResult <> grOk then Halt(1);
  355. ClearDevice;
  356. SetColor(Magenta);
  357. SetTextStyle(TriplexFont, HorizDir,10);
  358. OutTextXY(150,100,'Game');
  359. OutTextXY(170,200,'OveR');
  360. SetColor(Green);
  361. SetTextStyle(SmallFont, HorizDir,20);
  362. OutTextXY(180,430,'Another Game ? ');
  363. h := readkey;
  364. if (h = 'y') or (h = 'Y') then
  365. begin
  366. CloseGraph;
  367. Game;
  368. end;
  369. Close(Tbl);
  370. Halt;
  371. end; {Ext}
  372. {-------------------------------------------------------}
  373. Procedure StartUp;
  374. var
  375. Gd, Gm : Integer;
  376. begin
  377. Gd := Detect;
  378. InitGraph(Gd, Gm, '');
  379. if GraphResult <> grOk then Halt(1);
  380. ClearDevice;
  381. SetColor(Blue);
  382. SetTextStyle(3, HorizDir,8);
  383. OutTextXY(80,100,'Game Piton');
  384. SetTextStyle(2,HorizDir,5);
  385. SetColor(LightGreen);
  386. OutTextXY(230,460,'Game PITON written in 1998 by Kesha Enikeew AKA Ray');
  387. SetColor(White);
  388. SetTextStyle(1,HorizDir,2);
  389. OutTextXY(20,400,'Press "S" for Setup, "Q" to Quit, any other to continue');
  390. case ReadKey of
  391. 's','S' : setup;
  392. 'q','Q' : begin
  393. CloseGraph;
  394. halt;
  395. end;
  396. end;
  397. CloseGraph
  398. end; {StartUp}
  399. {------------------==================-------------------}
  400. Procedure DrawTable;
  401. var y:integer;
  402. begin
  403. clrscr;
  404. TextColor(blue);
  405. GotoXY(40,2);
  406. Write('Game PITON');
  407. TextColor(7);
  408. for y := 20 to 79 do
  409. begin
  410. GotoXY(y, 3);
  411. Write('═');
  412. GotoXY(y, 25);
  413. Write('═');
  414. end;
  415. Write('╝');
  416. GotoXY(80, 2);
  417. Write('╗');
  418. For y := 3 to 23 do
  419. begin
  420. GotoXY(20, y);
  421. Write ('║');
  422. GotoXY(WhereX-1, WhereY + 1);
  423. Write('╚');
  424. GotoXY(80, y);
  425. Write ('║')
  426. end;
  427. GotoXY(20,2);
  428. Write('╔');
  429. end; {DrawTable}
  430. {-------------------------------------------------------}
  431. Procedure Game;
  432. Var y : byte;
  433. begin
  434. Now := 7;
  435. SetCursorSize(16*256);
  436. ClrScr;
  437. TextBackGround(0);
  438. assign(Tbl,'hiscore.dat');
  439. {$I-}
  440. Reset(Tbl);
  441. {$I+}
  442. if IOResult <> 0 then
  443. ReWrite(tbl);
  444. FindFirst('Hiscore.dat',AnyFile,s);
  445. if s.size = 0 then
  446. begin
  447. if max.sp = 0 then
  448. max.sp := 5 ;
  449. max.Score[1] := 9;
  450. max.name[1] := 'Coder';
  451. Seek(tbl,0);
  452. Write(tbl,max);
  453. Close(tbl);
  454. Reset(tbl);
  455. end;
  456. {$I-}
  457. Read(tbl,max);
  458. {$I+}
  459. If IOResult <> 0 then Halt;
  460. StatMain;
  461. cl := 7;
  462. TextColor(7);
  463. e := 1;
  464. en[1] := 39;
  465. en[2] := 13;
  466. Num := 1;
  467. Dir := 1;
  468. b := 10;
  469. FullClnBuf;
  470. col := 9;
  471. a[39,13] := 1;
  472. GotoXY(40,13);
  473. repeat
  474. ai;
  475. l := 0;
  476. if keypressed or (c = #27) or (w = 77) or (w = 75) then
  477. begin
  478. if (c <> #27) and (w <> 77) and (W <> 75) then c := readkey;
  479. if c = #0 then
  480. Begin
  481. if (w <> 77) and (w <> 75) then w := ord(readkey);
  482. if (w = 77) or (w = 75) then
  483. begin
  484. l := 1;
  485. case w of
  486. 77 : case dir of
  487. 1 : begin
  488. if WhereX > 79 then ext;
  489. if a[whereX,WhereY] > 0 then ext;
  490. if a[WhereX,WhereY] < 0 then
  491. begin
  492. b := b - a[WhereX,WhereY];
  493. inc(col,-a[whereX,WhereY]);
  494. TextColor(now);
  495. end;
  496. Write('╗');
  497. inc(num);
  498. a[WhereX-1,WhereY] := Num;
  499. dir := 2;
  500. if b > 0 then dec(b);
  501. end;
  502. 2 : begin
  503. if (WhereY + 1) > 23 then ext;
  504. if a[whereX-1,WhereY+1] > 0 then ext;
  505. if a[WhereX-1,WhereY+1] < 0 then
  506. begin
  507. b := b - a[WhereX-1,WhereY+1];
  508. inc(col, -a[WhereX-1,WhereY+1]);
  509. TextColor(now);
  510. end;
  511. GotoXY(WhereX-1,WhereY+1);
  512. Write('╝');
  513. inc(num);
  514. a[WhereX-1,WhereY] := Num;
  515. dir := 3;
  516. if b > 0 then dec(b);
  517. end;
  518. 3 : begin
  519. if (WhereX - 2) < 21 then ext;
  520. if a[whereX-2,WhereY] > 0 then ext;
  521. if a[WhereX-2,WhereY] < 0 then
  522. begin
  523. b := b - a[WhereX-2,WhereY];
  524. inc(col, -a[WhereX-2,WhereY]);
  525. TextColor(now);
  526. end;
  527. GotoXY(WhereX-2,WhereY);
  528. Write('╚');
  529. inc(num);
  530. a[WhereX-1,WhereY] := num;
  531. if b > 0 then dec(b);
  532. Dir := 4
  533. end;
  534. 4 : begin
  535. if (WhereY - 1) < 3 then ext;
  536. if a[whereX-1,WhereY-1] > 0 then ext;
  537. if a[WhereX-1,WhereY-1] < 0 then
  538. begin
  539. b := b - a[WhereX-1,WhereY-1];
  540. inc(col, -a[WhereX-1,WhereY-1]);
  541. TextColor(now);
  542. end;
  543. GotoXY(WhereX-1,WhereY-1);
  544. Write('╔');
  545. inc(num);
  546. a[WhereX-1,WhereY] := Num;
  547. if b > 0 then dec(b);
  548. Dir := 1
  549. end;
  550. end;
  551. 75 : case dir of
  552. 1 : begin
  553. if WhereX > 79 then ext;
  554. if a[whereX,WhereY] > 0 then ext;
  555. if a[WhereX,WhereY] < 0 then
  556. begin
  557. b := b - a[WhereX,WhereY];
  558. inc(col, -a[WhereX,WhereY]);
  559. TextColor(now);
  560. end;
  561. Write('╝');
  562. inc(num);
  563. a[WhereX-1,WhereY] := Num ;
  564. if b > 0 then dec(b);
  565. dir := 4
  566. end;
  567. 2 : begin
  568. if WhereY + 1 > 23 then ext;
  569. if a[whereX-1,WhereY+1] > 0 then ext;
  570. if a[WhereX-1,WhereY+1] < 0 then
  571. begin
  572. b := b - a[WhereX-1,WhereY+1];
  573. inc(col, -a[WhereX-1,WhereY+1]); TextColor(now);
  574. end;
  575. GotoXY(WhereX-1,WhereY + 1);
  576. Write('╚');
  577. inc(num);
  578. a[WhereX-1,WhereY] := Num;
  579. if b > 0 then dec(b);
  580. dir := 1;
  581. end;
  582. 3 : begin
  583. if WhereX - 2 < 21 then ext;
  584. if a[whereX-2,WhereY] > 0 then ext;
  585. if a[WhereX-2,WhereY] < 0 then
  586. begin
  587. inc(b, - a[WhereX-2,WhereY]);
  588. inc(col, -a[WhereX-2,WhereY]);
  589. TextColor(now);
  590. end;
  591. GotoXY(WhereX-2,WhereY);
  592. Write('╔');
  593. inc(num);
  594. a[WhereX-1,WhereY] := num;
  595. if b > 0 then dec(b);
  596. Dir := 2
  597. end;
  598. 4 : begin
  599. if WhereY - 1 < 3 then ext;
  600. if a[whereX-1,WhereY-1] > 0 then ext;
  601. if a[WhereX-1,WhereY-1] < 0 then
  602. begin
  603. b := b - a[WhereX-1,WhereY-1];
  604. inc(col, -a[WhereX-1,WhereY-1]);
  605. TextColor(now);
  606. end;
  607. GotoXY(WhereX-1,WhereY - 1);
  608. Write('╗');
  609. inc(num);
  610. a[WhereX-1,WhereY] := num ;
  611. if b > 0 then dec(b);
  612. Dir := 3
  613. end;
  614. end;
  615. end;
  616. end;
  617. end
  618. else if c = #27 then Ext;
  619. end;
  620. begin
  621. if l = 0 then
  622. begin
  623. case dir of
  624. 1 : if WhereX > 79 then ext
  625. else
  626. if a[WhereX,WhereY] > 0 then ext
  627. else
  628. begin
  629. if a[WhereX,WhereY] < 0 then
  630. begin
  631. b:=b-a[WhereX,WhereY];
  632. inc(col,-a[whereX,WhereY]);
  633. TextColor(now);
  634. end;
  635. Write('═');
  636. inc(num);
  637. a[WhereX-1,WhereY] := Num;
  638. if b > 0 then b := b - 1;
  639. end;
  640. 2: if (WhereY + 1) > 23 then ext
  641. else
  642. if a[WhereX-1,WhereY+1] > 0 then ext
  643. else
  644. begin
  645. if a[WhereX-1,WhereY+1] < 0 then
  646. begin
  647. b := b-a[WhereX-1,WhereY+1];
  648. inc(col, -a[WhereX-1,WhereY+1]);
  649. TextColor(now);
  650. end;
  651. GotoXY(WhereX-1,WhereY+1);
  652. Write('║');
  653. inc(num);
  654. a[WhereX-1,WhereY] := Num;
  655. if b > 0 then b := b - 1;
  656. end;
  657. 3 : if (WhereX-2) < 21 then ext
  658. else
  659. if a[WhereX-2,WhereY] > 0 then ext
  660. else
  661. begin
  662. if a[WhereX-2,WhereY] < 0 then
  663. begin
  664. b:=b-a[WhereX-2,WhereY];
  665. inc(col, -a[WhereX-2,WhereY]);
  666. TextColor(now);
  667. end;
  668. GotoXY(Wherex-2,WhereY);
  669. Write('═');
  670. inc(Num);
  671. a[WhereX-1,WhereY] := Num ;
  672. if b > 0 then dec(b);
  673. end;
  674. 4 : if (WhereY - 1) < 3 then ext
  675. else
  676. if a[WhereX-1,WhereY-1] > 0 then ext
  677. else
  678. begin
  679. if a[WhereX-1,WhereY-1] < 0 then
  680. begin
  681. b := b - a[WhereX-1,WhereY-1];
  682. inc(col, -a[WhereX-1,WhereY-1]);
  683. TextColor(now);
  684. end;
  685. GotoXY(WhereX-1,WhereY-1);
  686. Write('║');
  687. inc(Num);
  688. a[WhereX-1,WhereY] := Num ;
  689. if b > 0 then dec(b);
  690. end;
  691. end;
  692. end;
  693. end;
  694. Stat1(WhereX,WhereY);
  695. if b = 0 then
  696. begin
  697. bg[1] := WhereX;
  698. bg[2] := WhereY;
  699. GotoXY(en[1],en[2]);
  700. Write(' ');
  701. a[WhereX-1,WhereY] := 0;
  702. en[1] := Last(e) mod 100;
  703. en[2] := Last(e) div 100;
  704. GotoXY(bg[1],bg[2]);
  705. inc(e);
  706. end;
  707. ClnBuf;
  708. Delay(1000);
  709. test := true;
  710. for i := 21 to 79 do
  711. for j := 3 to 24 do
  712. if a[i,j] < 0 then test := false;
  713. if test then apple;
  714. until false;
  715. end;
  716. Begin
  717. StartUp;
  718. Game;
  719. end.