Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function right()
- turtle.turnRight()
- turtle.forward()
- turtle.turnRight()
- end
- function left()
- turtle.turnLeft()
- turtle.forward()
- turtle.turnLeft()
- end
- function move(area)
- local totalarea = area*2
- local lengthdetection = 0
- local direction = 'right'
- for i = 1,totalarea do
- turtle.forward()
- lengthdetection =lengthdetection + 1
- if lengthdetection == 5 then
- if direction == 'right' then
- direction = 'left'
- right()
- end
- if direction == 'left'then
- direction = 'right'
- left()
- end
- lengthdetection = 0
- end
- end
- end
- write('Enter Area')
- area = read()
- move(area)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement