program liikumine; uses crt; var loomx,loomy:integer; suund,minax,minay:integer; siht:string; surm:boolean; begin clrscr; randomize; loomx:=random(80)+1; loomy:=random(25)+1; minax:=1; minay:=1; surm:=false; repeat suund:=random(4); {0-yles, 1-paremale, 2-alla, 3-vasakule} if (suund=0) and (loomy=1) then suund:=2; if (suund=1) and (loomx=80) then suund:=3; if (suund=2) and (loomy=25) then suund:=0; if (suund=3) and (loomx=1) then suund:=1; case suund of 0:loomy:=loomy-1; 1:loomx:=loomx+1; 2:loomy:=loomy+1; 3:loomx:=loomx-1; end; textcolor(red); gotoxy(loomx,loomy); write('*'); delay(100); if keypressed then begin textcolor(black); gotoxy(minax,minay); write('@'); siht:=readkey; case upcase(siht[1]) of 'I':minay:=minay-1; 'L':minax:=minax+1; 'K':minay:=minay+1; 'J':minax:=minax-1; end; if minay=0 then surm:= true; if minax=81 then surm:= true; if minay=26 then surm:= true; if minax=0 then surm:= true; textcolor(green); gotoxy(minax,minay); write('@'); end; textcolor(black); gotoxy(loomx,loomy); write('*'); until (surm) or ((minax=loomx) and (minay=loomy)); textcolor(lightgray); if surm then write('Sa surid') else write('“nnitlen v6idu puhul'); readln; textcolor(white); end.