Среда разработки: Turbo Pascal 7.1

uses crt;
const maxx=12;
      maxy=7;
var map: array [1..maxx,1..maxy] of byte;
    x,y,manx,many:byte;
    c,m:char;
{-------------------------------}
procedure doroga(x,y:byte);
begin
textcolor(brown);
gotoxy(x,y);   write('=====');
gotoxy(x,y+1); write('=====');
gotoxy(x,y+2); write('=====');
end;
{-------------------------------}
procedure elka(x,y:byte);
begin
textcolor(green);
gotoxy(x,y);   write('  |  ');
gotoxy(x,y+1); write(' /|\ ');
gotoxy(x,y+2); write('//|\\');
end;
{-------------------------------}
procedure man(x,y:byte);
begin
textcolor(white);
gotoxy(x,y);   write('  O  ');
gotoxy(x,y+1); write(']-|-[');
gotoxy(x,y+2); write('_/ \_');
end;
{-------------------------------}
procedure more(x,y:byte);
begin
textcolor(blue);
gotoxy(x,y);   write('~~~~~');
gotoxy(x,y+1); write('~~~~~');
gotoxy(x,y+2); write('~~~~~');
end;
{-------------------------------}
procedure palma(x,y:byte);
begin
textcolor(brown);
gotoxy(x,y);   write(' (#) ');
gotoxy(x,y+1); write('( # )');
gotoxy(x,y+2); write('__#__');
end;
{-------------------------------}
procedure korabl(x,y:byte);
begin
textcolor(white);
gotoxy(x,y);   write(' |)  ');
gotoxy(x,y+1); write(' |_) ');
gotoxy(x,y+2); write('\___/');
end;
{-------------------------------}
procedure generate_map;
begin
randomize;
for x:=1 to maxx do
    for y:=1 to maxy do
        map[x,y]:=random(2);
end;
{-------------------------------}
begin
clrscr;
generate_map;
textcolor(yellow);
m:='l';
gotoxy(5,25);
write('['#25','#24','#27','#26,'] -- управление
	[Esc] -- выход [m] -- лес/море');
repeat
manx:=random(maxx)+1;
many:=random(maxy)+1;
until (map[manx,many]=0) and
      ((map[manx+1,many]=0) or (map[manx-1,many]=0) or
      (map[manx,many+1]=0) or (map[manx+1,many-1]=0));

repeat
for x:=1 to maxx do
    for y:=1 to maxy do
        case m of
             'l': begin
                  man(manx*6,many*3);
                  case map[x,y] of
                       0: doroga(x*6,y*3);
                       1: elka(x*6,y*3);
                  end; end;
             'm': begin
                  korabl(manx*6,many*3);
                  case map[x,y] of
                       0: more(x*6,y*3);
                       1: palma(x*6,y*3);
                  end; end;
        end;

c:=readkey;
case c of
     #72: if (many-1>0) and (map[manx,many-1]=0) then dec(many);
     #80: if (many+1<=maxy) and (map[manx,many+1]=0)  then inc(many);
     #77: if (manx+1<=maxx) and (map[manx+1,many]=0)  then inc(manx);
     #75: if (manx-1>0) and (map[manx-1,many]=0)  then dec(manx);
     'm': if m='l' then m:='m' else m:='l'
     end
until c=#27;
end.
Hosted by uCoz