All pastes #451650 Raw Edit

Someone

public text v1 · immutable
·published 2007-04-21 18:38 UTC
rendered paste body
program Bot;
type wsp = record
       x,y:integer;
     end;
     rozkaz = record
       a,x,y:integer;
     end;

var s:string;
    arena:array[1..20] of string[20];
    i,j:integer;
    nrgracza:byte;
    enemytanks:array[1..4] of wsp;
    enemytankshp:array[1..4] of integer;
    allytanks:array[1..4] of wsp;
    allytankshp:array[1..4] of integer;
    finish:boolean;
    rozkazy:array[1..4] of rozkaz;

begin
  Readln(nrgracza);
  for i:=1 to 20 do Readln(arena[i]);
  for i:=1 to 20 do begin
    for j:=1 to 20 do begin
      if nrgracza = 1 then begin
        case arena[i][j] of
          'A':begin
                allytanks[1].x:=j;
                allytanks[1].y:=i;
              end;
          'B':begin
                allytanks[2].x:=j;
                allytanks[2].y:=i;
              end;
          'C':begin
                allytanks[3].x:=j;
                allytanks[3].y:=i;
              end;
          'D':begin
                allytanks[4].x:=j;
                allytanks[4].y:=i;
              end;
        end;
      end
      else begin
        case arena[i][j] of
          'E':begin
                allytanks[1].x:=j;
                allytanks[1].y:=i;
              end;
          'F':begin
                allytanks[2].x:=j;
                allytanks[2].y:=i;
              end;
          'G':begin
                allytanks[3].x:=j;
                allytanks[3].y:=i;
              end;
          'H':begin
                allytanks[4].x:=j;
                allytanks[4].y:=i;
              end;
        end;
      end;
    end;
  end;
  for i:=1 to 4 do enemytankshp[i]:=5;
  finish:=false;
  while true do begin
    Read(enemytanks[1].x,enemytanks[1].y,enemytanks[2].x,enemytanks[2].y,
           enemytanks[3].x,enemytanks[3].y,enemytanks[4].x,enemytanks[4].y,
           allytankshp[1],allytankshp[2],allytankshp[3],allytankshp[4]);
    Write(rozkazy[1].a,' ',rozkazy[1].x,' ',rozkazy[1].y,' ',rozkazy[2].a,' ',
           rozkazy[2].x,' ',rozkazy[2].y,' ',rozkazy[3].a,' ',rozkazy[3].x,
           rozkazy[3].y,' ',rozkazy[4].a,' ',rozkazy[4].x, ' ',rozkazy[4].y, chr(10));
    flush(output);
  end;
end.