program Tiersuche_im_Feld; uses Crt, CursorOnOff; type TBuchQuadrat = array[1..20,1..20] of char; const DesktopCol=2; Quadrat: TBuchQuadrat = (('A','M','S','E','L','L','E','R','O','F','M','R','U','W','D','N','A','B','O','A'), ('L','E','G','I','U','H','E','G','N','A','L','H','C','S','N','A','N','D','U','L'), ('B','O','C','K','B','U','E','N','A','Y','H','O','R','N','I','S','S','E','H','L'), ('N','H','A','H','E','H','S','U','A','L','U','C','H','S','T','S','R','L','U','I'), ('R','P','N','E','Z','N','A','W','R','E','H','D','R','A','P','O','E','L','R','G'), ('E','A','I','E','R','E','W','I','E','S','E','L','R','E','C','H','L','I','U','A'), ('P','V','U','C','E','T','R','A','D','N','A','P','C','H','C','E','S','R','G','T'), ('I','I','G','H','T','S','O','B','N','A','L','H','S','S','O','C','T','G','N','O'), ('V','A','N','W','T','U','D','A','A','P','T','E','U','Z','Y','H','E','B','A','R'), ('M','N','I','A','A','G','N','R','R','M','I','M','S','I','O','T','R','L','K','H'), ('M','I','P','N','N','N','O','S','A','I','L','E','L','E','T','T','A','R','C','S'), ('E','U','L','R','S','A','K','C','W','H','T','T','N','G','E','M','A','S','U','H'), ('R','B','W','B','E','L','L','H','H','C','I','A','N','E','A','N','I','A','K','C'), ('E','B','B','E','E','I','E','E','E','S','S','U','T','O','I','F','R','N','C','V'), ('I','E','L','O','F','T','E','W','D','H','E','N','B','C','I','B','E','T','U','F'), ('H','V','M','L','R','F','O','G','O','V','E','R','H','A','O','P','D','I','K','A'), ('E','L','E','E','L','L','A','R','A','U','P','E','I','R','K','F','R','L','R','H'), ('R','E','G','E','L','E','N','M','K','N','W','E','S','P','E','A','A','O','A','C'), ('E','I','N','D','E','B','U','A','T','E','S','I','E','M','A','U','M','P','C','S'), ('T','F','L','O','W','P','A','N','T','H','E','R','N','R','E','T','S','E','E','S')); var whats: string; times: byte; procedure DrawBorder(x1,y1,x2,y2,FG,BG: byte); const frame='Ű'; var i,j,xlen,ylen: byte; tox,toy: byte; xc,yc: byte; max: byte; DDel: byte; begin CursorOff; xlen := (x2-x1); ylen := (y2-y1); TextColor(FG); TextBackground(BG); if xlen>ylen then max:=xlen else max:=ylen; DDel:=400 DIV max; for i:=0 to max do begin tox:=(xlen*i) DIV max; toy:=(ylen*i) DIV max; for j:=0 to 100 do begin xc := (x1+(tox*(100-j) DIV 100)); yc := (y1+(toy*j DIV 100)); if (xc>x1) AND (yc>y1) AND (xcx1) AND (yc>y1) AND (xc=1) AND (ay<=20) AND (ax>=1) AND (ax<=20) then Write(Quadrat[ay,ax]); case dir of 1: Dec(ay); 2: begin Inc(ax); Dec(ay); end; 3: Inc(ax); 4: begin Inc(ax); Inc(ay); end; 5: Inc(ay); 6: begin Dec(ax); Inc(ay); end; 7: Dec(ax); 8: begin Dec(ax); Dec(ay); end; end; Dec(i); until i=0; Delay(30); TextBackground(0); TextColor(15); end; procedure Search(what: string); var i,j,k: byte; ox,oy: byte; tmp: string; begin TextBackground(0); ox:=1; oy:=1; for i:=1 to 20 do begin for j:=1 to 20 do begin (* Mark(j,i,1,1,9,1); *) if (Quadrat[i,j]=what[1]) then begin for k:=1 to 8 do begin tmp:=Get(j,i,k,Length(what)); (* Mark(j,i,k,Length(what),0,1); *) if tmp=what then begin Window(5,30,75,46); GotoXY(ox,oy); Inc(times); WriteLn('Hab ''',what,''' bei (',j:2,'|',i:2,') gefunden. Richtung ',k,', L„nge ',Length(what)); ox:=WhereX; oy:=WhereY; Window(1,1,80,50); Mark(j,i,k,Length(what),0,7); Delay(50); end; (* Mark(j,i,k,Length(what),15,1); *) end; end; (* Mark(j,i,1,1,15,1); *) end; end; window(5,30,75,46); GotoXY(ox,oy); if (times=0) then begin WriteLn('Hab nix gefunden - versuch'' was anderes.'); end; end; procedure ClearErg; begin DrawBorder(3,28,77,47,DesktopCol,DesktopCol); DrawBorder(3,28,77,47,15,0); end; begin Init; repeat times:=0; { WriteMash; } ClearErg; Input; if (whats<>'') then begin Search(whats); WriteLn; WriteLn('[ Taste drcken, um fort zu fahren ]'); window(1,1,80,50); ReadKey; end; until whats=''; Outit; end.