View difference between Paste ID: 2SqDSa2z and fCWuYPTE
SHOW: | | - or go back to the newest paste.
1-
local robot = require ("robot")
1+
local robot = require ("robot")
2-
2+
3-
wall = 1
3+
wall = 1
4-
step = 0
4+
step = 0
5-
5+
6-
function robot.step()
6+
function robot.step()
7-
  repeat
7+
  repeat
8-
    if step < wall then
8+
    if step < wall then
9-
      robot.forward()
9+
      robot.forward()
10-
      step = step+1
10+
      step = step+1
11-
      os.sleep(2)
11+
      os.sleep(2)
12-
    end
12+
    end
13-
  until step == wall
13+
  until step == wall
14-
  print("Length reached, turning right")
14+
  print("Length reached, turning right")
15-
  robot.turnRight()
15+
  robot.turnRight()
16-
  step = 0
16+
  step = 0
17-
  repeat
17+
  repeat
18-
    if step < wall then
18+
    if step < wall then
19-
      robot.forward()
19+
      robot.forward()
20-
      step = step + 1
20+
      step = step + 1
21-
      os.sleep(2)
21+
      os.sleep(2)
22-
    end
22+
    end
23-
  until step == wall
23+
  until step == wall
24-
  wall = wall+1      
24+
  robot.turnRight()
25-
end
25+
  wall = wall+1      
26-
26+
end
27-
repeat
27+
28-
 robot.step()
28+
repeat
29
 robot.step()
30
until false