. , , ,

,,,

"" — ,

1.         3

2.         4

3.         蠠 4

4.         5

5.         8

6.         24

7.         24

8.         25

9.         堠 30

10.      31

1 32

2 . 46


1.    

, .

.

, , , .

:

-     , 16 . , 1 15 .

1:

1 .

5 7 3 8
15 1 13 2
14 10 6 4
9 11 12

-     .

-     , ( 2), .


2 .

1 2 3 4
5 6 7 8
9 10 11 12
13 14 15

2.    

, . . , , .


3.     .

. .

, , .

:

a.      ;

b.     , , ;

c.      ;

d.     ;

e.      , .. , .

f.      .

:

-       (, );

-       (, );

-       ;

-       ;

-       ;

-       .

, .


4.    

. - Windows. Graph. , , .

, , . :

-       , .. , ;

-       . , ;

-       .

:

-       Tablo;

-       Vivod;

-       Napravlenie;

-       Poisk;

-       Zamena;

-       Proverka;

-       Mesto;

-       Game15

:

-       ReadFile;

-       WriteFile;

-       Bonus.

5, .

4.1 .

 

4.1.1 procedure Tablo;

, , 1 15 . : .

16 , , , .

, . , 5, 5 . 16, .

4.1.2 procedure Vivod;

. , . , .

4.1.3 procedure Napravlenie;

, , . , .


4.1.4 Procedure Poisk;

. , . . , .

4.1.5 procedure Zamena;

.

, , , , , .

4.1.6 procedure proverka;

, , . , .

4.1.7 procedure Mesto;

, ( ), . , .


4.1.8 procedure Game15;

. .

, ESC.

4.2 .

 

4.2.2 procedure readFile;

( 4.1.7), res.txt

4.2.3 procedure writeFile;

res.txt , , .

4.2.4 procedure bonus;

. . , , , End . , .


4.3 .

.

, .. , , , , , , .


5.    

, . , .

( 1):

-     ;

-     ;

-     ;

-     .



1 -

5.1 .

 

, , .

Avtor. fhelp1.txt , .

( 2):

   fhelp1.txt;

   ;

   .


2 -

5.1.1 .

assign(f,'fhelp1.txt'), f fhelp1.txt, . , , . , , , , , , . , , , . reset(f) .

5.1.2 readln(f,g1); writeln(g1). , g1, readln fhelp1.txt, writeln g1.

5.1.3 , close (f);

5.2 .

, .

help. fhelp.txt .

, , 5.1 , , fhelp.txt, .

5.3 .

. . Game15.

:

-     ;

-     ;

-     ;

-     ;

-     ;

-     ;

-     ;

-     ;

-     .

, , 3.








3 .

5.3.1 Game15, . , InitGraph (grDriver, grMode, grPath), grDriver (VGA), grMode (VGAHi), grPath EGAVGA.BGI ( , , , ).

5.3.2    .

, , . ( ), , 1 15 .

Tablo. , 1 15 . , , . , , .

, . random, , , .

, , . integer, , , string. , , 1 16, , . , 11 11.

( 4):

   ;

   ;

   ;

   ;

   .






4

5.3.2.1           .

b , random. random 1 16.

5.3.2.2          

b bs[i], For if. , b, . , b , .


5.3.2.3           .

b, , bs[i],

5.3.2.4           .

, , 5.3.2.1.

, 1 16.

5.3.2.5           .

, For i j, .

:

   z . .

   j i , z , 8, 8 . 16. . case.

   , .

5.3.3   .

. , . 5.3.2, , .

Vivod.

( 5):

   ;

   ;

   .


5 -

5.3.3.1      .

:

-       , (h1, w1, );

-       SetFillStyle, . , SolidFill , .. .

-       Bar .

-       16 , For.

5.3.3.2      .

, , , Line.

5.3.3.3      .

, .

, OutTextXY.

, , .

, , , , .

5.3.4  .

,

Poisk. For i j AS, , IF , i j strok stolb. , strok stolb .

( 6):

   ;

   , ;

   .


򠠠


6 -

5.3.4.1      .

For .

5.3.4.2      , .

If, .

5.3.4.3      .

strok Stolb .


5.3.5   .

, . , .

Napravlenie.

ch ( char) .

:

   , , .

   , , ch, readkey.

, , , 72.

5.3.6      .

, , , , :

-     , ;

-     ;

-     ;

-     .

Zamena.

( 7):

-   ;

-   ;

-   .


7 - .

5.3.6.1           .

, , , . IF ord, .

5.3.6.2           .

Strok, Stolb, (5.3.4) , .

, , , 72, , if ord (if ord(ch)=72 then), .

: , as[strok,stolb], (as[strok,stolb]:= as[strok+1,stolb];), , (as[strok+1,stolb]:=' ';).

5.3.6.3           .

, hod 0. , . , hod . , .

5.3.7    .

, . , , , , 5.3.3.

proverka.

prov false (). 1, .. , , prov true ().

5.3.8      .

, , , . , , , . , .

Mesto.

( 8):

-       ;

-       ;

-       , ;

-       ;

-       ;

-       .

 




- 8 .

5.3.8.1          

, . , , .. , , , ( hod).

5.3.8.2           .

res.txt , it res. it , , , res .

5.3.8.3           ,

it.

, , , (. .)


5.3.8.4           .

, .

5.3.8.5           .

, , , , , .

. , it res , , , , , itv resv, . :

For (it), ( hod). it , it res itv resv. it it, itv resv, it res itv resv . For it, , , it, . , it res itv resv. itv resv , it res, , , itv resv. .

:

3 . it, res.

3 it res.

It 10 20 30 40 50 60 70 80 90 95
res A B C D E F G H K L

, , Z, 44 .

(44). it hod. 44, itv resv, 44, itv resv ( 4)

4 it res.

Itv 10 20
resv A B

, it, 44, , 44 it. , Z, itv resv , it res, , Z ( 5).


5 it res.

Itv 10 20 30 40 44 50
resv A B C D Z E

, 44 50, 40, 40 44, 50.

, 44 60, 44 60, 44 50, , 60 itv resv. itv resv, . ( 6)

6 it res.

Itv 10 20 30 40 44 50 60 70 80 90
resv A B C D Z E F G H K

, , it res, .

5.3.8.6           .

itv resv res.txt. , res.txt .


5.4   .

, .

result. res.txt .

, , 5.1 , , , res.txt, .


6.    

7 , ,

7

2.

4. :

-      ;

-      ;

-     

-      ;

-      ESC

5. .

1.

3. :

-     

-     

-     

-     


7.     .

, - , Windows.

8.    

9.      

8.1. Super15.exe. ( 1)

1

:

1.   (About program).

2.   (Key).

3.   (Play).

4.   (Results).

5.   (Exit).

, .

8.2 ( 2), :

-       ;

-       ;

-       ;

2

8.3 .

( 3).

3 -

8.4 .

( 4), 15 , .

4 .

:

-       , ;

-       ;

-       ;

.

, , , , 5

5 , .

, , ESC , .

, , , , , , , ( 6).

6 -

8.5 .

 

( 7), , .

Move , Name .

7

8.5 .

, .


10.  

, , . , , , . , , .

, , , , . :

-     ;

-     ;

-     ;

-     ;

-     ;

-     .


11.  

10.1 . , . .

10.2 . Turbo Pascal, . .

10.3 .


1

program Game;

uses crt, Graph;

var

as:array[1..4,1..4] of string; { , }

bs:array[1..16] of integer; { }

men:array[1..5] of integer; { }

res:array[1..10] of string; { }

it:array[1..10] of integer; { }

resv:array[1..10] of string; { }

itv:array[1..10] of integer; { }

i,j:integer; { }

strok, stolb:integer; { }

hod:integer; {, }

lom:integer; { }

name:string; { }

ch:char; {, }

prov:boolean;{ }

f: text; { }

procedure Vivod;

{ }

var lx,ly:integer; { }

x,y:integer; { }

j1,i1:integer; { , }

w1,h1:integer; { }

begin

OutTextXY(210,50,'For leaving press ESC');

w1:=30;

h1:=30; { 30 30}

for i1:=0 to 3 do {, }

for j1:=0 to 3 do

begin

x:=235+j1*35; { }

y:=150+i1*35; { }

setFillStyle(1,1); { , , }

Bar(x,y,x+w1,y+h1); { }

end;

lx:=245;

ly:=162;

for i:=1 to 4 do { }

begin

for j:=1 to 4 do

begin

OutTextXY(lx,ly,as[i,j]); { }

lx:=lx+35;

end;

lx:=245;

ly:=ly+35;

end;

line(220,135,220,300); { }

line(385,135,385,300);

line(220,135,385,135);

line(220,300,385,300);

end;

procedure Tablo;

{ }

var b:integer; {, }

k,z:integer;{ }

begin

randomize;

For z:=1 to 16 do

begin

b:=random(15); { }

k:=1;

while k<>17 do { }

begin

if bs[k]=b then

begin

b:=random(17);

k:=1;

end

else k:=k+1;

end;

bs[z]:=b; { }

end;

z:=1;

for i:=1 to 4 do { , , }

begin

for j:=1 to 4 do

begin

case bs[z] of

1: as[i,j]:='1 ';

2: as[i,j]:='2 ';

3: as[i,j]:='3 ';

4: as[i,j]:='4 ';

5: as[i,j]:='5 ';

6: as[i,j]:='6 ';

7: as[i,j]:='7 ';

8: as[i,j]:='8 ';

9: as[i,j]:='9 ';

10: as[i,j]:='10';

11: as[i,j]:='11';

12: as[i,j]:='12';

13: as[i,j]:='13';

14: as[i,j]:='14';

15: as[i,j]:='15';

16: as[i,j]:=' ';

end;

z:=z+1;

end;

end;

vivod; { }

end;

Procedure Poisk;

{ }

begin

for i:=1 to 4 do

begin

for j:=1 to 4 do

begin

if as[i,j] = ' ' Then {, }

begin

Strok:=i; { , }

Stolb:=J

end;

end;

end;

end;

procedure bonus;

{, . END }

begin

as[1,1]:='1 ';as[1,2]:='2 ';as[1,3]:='3 ';as[1,4]:='4 ';

as[2,1]:='5 ';as[2,2]:='6 ';as[2,3]:='7 ';as[2,4]:='8 ';

as[3,1]:='9 ';as[3,2]:='10';as[3,3]:='11';as[3,4]:='12';

as[4,1]:='13';as[4,2]:='14';as[4,4]:='15'; as[4,3]:=' ';

Strok:=4; Stolb:=3;

end;

procedure napravlenie;

{ }

begin

ch:=readkey; { }

end;

procedure Zamena;

{ }

begin

napravlenie; {, }

if ord (ch)=79 then bonus; { END }

if ord(ch)=75 then { }

begin

if stolb<>4 then { , }

begin

as[strok,stolb]:=as[strok,stolb+1]; { }

as[strok,stolb+1]:=' '; { }

stolb:=stolb+1; { }

hod:=hod+1; { }

end;

end;

if ord(ch)=72 then { }

begin

if strok<>4 then { , }

begin

as[strok,stolb]:=as[strok+1,stolb]; { }

as[strok+1,stolb]:=' '; { }

strok:=strok+1;{ }

hod:=hod+1; { }

end;

end;

if ord(ch)=77 then { }

begin

if stolb<>1 then { , }

begin

as[strok,stolb]:=as[strok,stolb-1]; { }

as[strok,stolb-1]:=' '; { }

stolb:=stolb-1; { }

hod:=hod+1; { }

end;

end;

if ord(ch)= 80 then { }

begin

if strok<>1 then { , }

begin

as[strok,stolb]:=as[strok-1,stolb];{ }

as[strok-1,stolb]:=' '; { }

strok:=strok-1; { }

hod:=hod+1; { }

end;

end;

Vivod;

end;

procedure readFile;

{ }

begin

assign(f,'res.txt'); { }

reset(f); { }

j:=1;

for i:=1 to 10 do

begin

readln(f,res[i]); { }

readln(f,it[j]); { }

j:=j+1; { }

end;

close(f);

end;

procedure writeFile;

{ }

begin

assign(f,'res.txt'); { }

rewrite(f);{ }

for i:=1 to 10 do

begin

writeln(f,resv[i]);writeln(f,itv[i]); { }

end;

close(f);

end;

procedure Mesto;

{ , }

var chetcik:integer; {, , }

begin

if prov = true then { }

begin

readfile; { }

chetcik:=0;

j:=1;

for i:=1 to 10 do

begin

if (hod<=it[i]) and (hod>=it[i-1]) and (chetcik<1) then

begin

{ }

OutTextXY(132,325,'will Enter name and press Enter:');

line(400,338,530,338);

GoToXY(52,21);

read(name);

{ }

itv[i]:=hod;

resv[i]:=name;

j:=j+1;

chetcik:=1;

end;

{ }

if j<=10 then

begin

itv[j]:=it[i];

resv[j]:=res[i];

j:=j+1;

end;

end;

writeFile; { }

OutTextXY(230,360,'For leaving press ENTER');

readln;

end;

end;

procedure proverka;

{ }

begin

prov:=false;

if (as[1,1]='1 ') and (as[1,2]='2 ') and (as[1,3]='3 ') and (as[1,4]='4 ')

and (as[2,1]='5 ') and (as[2,2]='6 ') and (as[2,3]='7 ') and (as[2,4]='8 ')

and (as[3,1]='9 ') and (as[3,2]='10') and (as[3,3]='11') and (as[3,4]='12')

and (as[4,1]='13') and (as[4,2]='14') and (as[4,3]='15') and (as[4,4]=' ')

then

begin

prov:=true; { , }

OutTextXY(230,100,'Congratulate You have won');

Mesto; {, }

end;

end;

procedure Game15;

{ }

var grMode:integer; { }

grPath:string; { }

grDriver:integer;{ }

begin

hod:=0;

grDriver:=VGA;

grmode:=VGAHi;

grPath:='EGAVGA.BGI';

initGraph(grDriver, grMode,grPath); { }

Tablo; { }

Poisk; { }

repeat {, ESC }

Zamena; { }

proverka; { }

until (ord (ch)=27) or (prov=true);

closeGraph; { }

end;

procedure help;

{ }

var f: text; { }

g1:string; { }

begin

clrscr;

assign(f,'fhelp.txt'); { }

reset(f); { }

readln(f,g1); writeln(g1); { }

readln(f,g1); writeln(g1);

readln(f,g1); writeln(g1);

readln(f,g1); writeln(g1);

readln(f,g1); writeln(g1);

readln(f,g1); writeln(g1);

readln(f,g1); writeln(g1);

writeln('For leaving press ENTER');

readln;

close(f);{ }

end;

procedure result;

{ }

begin

clrscr;

GoToXY(26,5);

writeln('Best players');

assign(f,'res.txt');

reset(f);

readfile; { }

{ }

GoToXY(26,8); write('Move Name');

GoToXY(26,10); write(it[1]);GoToXY(36,10); writeln(res[1]);

GoToXY(26,11); write(it[2]);GoToXY(36,11);writeln(res[2]);

GoToXY(26,12); write(it[3]);GoToXY(36,12);writeln(res[3]);

GoToXY(26,13); write(it[4]);GoToXY(36,13);writeln(res[4]);

GoToXY(26,14); write(it[5]);GoToXY(36,14);writeln(res[5]);

GoToXY(26,15); write(it[6]);GoToXY(36,15);writeln(res[6]);

GoToXY(26,16); write(it[7]);GoToXY(36,16);writeln(res[7]);

GoToXY(26,17); write(it[8]);GoToXY(36,17);writeln(res[8]);

GoToXY(26,18); write(it[9]);GoToXY(36,18);writeln(res[9]);

GoToXY(26,19); write(it[10]);GoToXY(36,19);;writeln(res[10]);

GoToXY(26,23);writeln('For leaving press ENTER');

readln;

end;

procedure avtor;

{ }

var f: text; { }

g1:string; { }

begin

clrscr;

assign(f,'fhelp1.txt');

reset(f);

readln(f,g1); writeln(g1);

readln(f,g1); writeln(g1);

readln(f,g1); writeln(g1);

readln(f,g1); writeln(g1);

readln(f,g1); writeln(g1);

readln(f,g1); writeln(g1);

readln(f,g1); writeln(g1);

readln(f,g1); writeln(g1);

readln(f,g1); writeln(g1);

readln(f,g1); writeln(g1);

readln(f,g1); writeln(g1);

readln(f,g1); writeln(g1);

readln(f,g1); writeln(g1);

readln(f,g1); writeln(g1);

readln(f,g1); writeln(g1);

readln(f,g1); writeln(g1);

readln(f,g1); writeln(g1);

writeln('For exit press ENTER');

readln;

close(f);

end;

begin

{ }

{ }

{ , , }

men[1]:=15;

men[2]:=2;

men[3]:=2;

men[4]:=2;

men[5]:=2;

repeat

clrscr;

strok:=1; { }

Lom:=1;

{ }

GoToXY(32,10); Textcolor(men[1]); writeln('Key');

GoToXY(32,11); Textcolor(men[2]); writeln('About program');

GoToXY(32,12); Textcolor(men[3]); writeln('Play');

GoToXY(32,13); Textcolor(men[4]); writeln('Results');

GoToXY(32,14); Textcolor(men[5]); writeln('Exit');

ch:=readkey; { }

if (ord(ch)=80) then { , }

begin

for i:=1 to 5 do

begin

if (men[i]=15) and (strok<>5) then

begin

men[strok]:=2;

men[strok+1]:=15;

end

else strok:=strok+1;

end;

end;

if ord(ch)=72 then { , , }

begin

for i:=1 to 5 do

begin

if (men[i]=15) and (strok<>1)then

begin

men[strok]:=2;

men[strok-1]:=15;

end

else strok:=strok+1;

end;

end;

if ord(ch)=13 then { ENTER}

begin

for i:=1 to 5 do

begin

if men[i]=15 then

begin

if Lom=1 then begin Help; break; end; { }

if Lom=2 then begin avtor; break; end; { }

if Lom=3 then begin Game15;break; end; { }

if Lom=4 then begin result;break; end; { }

end

else Lom:=Lom+1;

end;

end;

until Lom=5 { EXIT}

end.


2 .

, .

, 1 15 ( 8).

8

. . () . , ( 9).

9

, , . , .

, ( 10).

10 .

, , 15 . ( 11).

, , , ( 11).

11

1. 3 2. 4 3. 蠠

 

 

 

! , , , .
. , :