uses crt; var x,y,bx,by,dead,rand,score: integer; msg: string; C:string[2]; procedure movie; begin C:=ReadKey; if C=#77 then begin x:=x+1; clrscr; gotoxy(x,y); write('o'); end; if C=#75 then begin x:=x-1; clrscr; gotoxy(x,y); write('o'); end; if C=#80 then begin y:=y+1; clrscr; gotoxy(x,y); write('o'); end; if C=#72 then begin y:=y-1; clrscr; gotoxy(x,y); write('o'); end; if C=#79 then begin dead:=1; end; end; procedure botx; begin if x>bx then bx:=bx+1 else if xby then by:=by+1 else if y ABS(y-by) then botx else if ABS(x-bx) < ABS(y-by) then boty else if ABS(x-bx) = ABS(y-by) then begin rand:=random(2); if rand>0 then botx else boty; end; gotoxy(bx,by); write('x'); end; procedure deadline; begin if ((bx=x) and (by=y)) then dead:=2; end; begin x:= 40; y:= 15; bx:=1; by:=15; dead:=0; clrscr; gotoxy(x,y); write('o'); gotoxy(bx,by); write('x'); while dead=0 do begin movie; bot; score:=score+1; gotoxy(1,1); write(score); deadline; end; clrscr; gotoxy(1,1); write(score); gotoxy(35,14); if dead=1 then msg:='Good Bye!' else if dead=2 then msg:='You are DEAD!'; write(msg); delay(1000); end.