Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:

робот 1 final

.pas
Скачиваний:
11
Добавлен:
16.01.2016
Размер:
1 Кб
Скачать
uses
  Robot;

var
  a: integer;

begin
  Task('mix5');
  
  var k: byte := 0;
  
  while not CellIsPainted and not wallFromRight do 
  begin
    right;
  end;
  while not cellIsPainted and not WallFromUp do
  begin
    Up;
  end;
  repeat
    while not cellIsPainted and not wallFromLeft do
    begin
      while freefromleft and not cellIsPainted do
      begin
        left;
      end;
      if not cellIsPainted then
      begin
        down;
      end;
    end;
    while not CellIsPainted and not WallFromRight do
    begin
      while not cellIsPainted and not wallFromRight do
      begin
        right;
      end;
      if not cellIsPainted then
      begin
        down;
      end;
    end;
  until not cellIsFree;
  
  if cellIsPainted then begin
    while not WallFromDown do
    begin
      down;
      paint;
      inc(k);
    end;
    for var i := 1 to k do up;
    a := 0;
    while not WallFromLeft do
    begin
      k := 0;
      left;
      paint;
      a := a + 1
    end;
    for var i := 1 to a do right;
    a := 0;
    while not WallFromRight do 
    begin
      right;
      paint;
      a := a + 1;
    end;
    for var i := 1 to a do left;
    a := 0;
    while not WallFromUp do
    begin
      up;
      paint;
      a := a + 1;
    end;
    for var i := 1 to a do down;
  end;
  
end.