Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- x, y, z, f = 0, 0, 0, 0
- function forward()
- if turtle.forward() then
- if f == 0 then
- x = x + 1
- elseif f == 1 then
- z = z + 1
- elseif f == 2 then
- x = x - 1
- elseif f == 3 then
- z = z - 1
- end
- return true
- end
- return false
- end
- function back()
- if turtle.back() then
- if f == 0 then
- x = x - 1
- elseif f == 1 then
- z = z - 1
- elseif f == 2 then
- x = x + 1
- elseif f == 3 then
- z = z + 1
- end
- return true
- end
- return false
- end
- function up()
- if turtle.up() then
- y = y + 1
- return true
- end
- return false
- end
- function down()
- if turtle.down() then
- y = y - 1
- return true
- end
- return false
- end
- function left()
- turtle.turnLeft()
- f = (f+3)%4
- end
- function right()
- turtle.turnRight()
- f = (f+1)%4
- end
- function home()
- while y ~= 0 do
- if y < 0 then
- turtle.digUp()
- up()
- elseif y > 0 then
- turtle.digDown()
- down()
- end
- end
- if z > 0 then
- while f ~= 3 do
- left()
- end
- elseif z < 0 then
- while f ~= 1 do
- left()
- end
- end
- while z ~= 0 do
- forward()
- end
- if x > 0 then
- while f ~= 2 do
- left()
- end
- elseif x < 0 then
- while f ~= 0 do
- left()
- end
- end
- while x ~= 0 do
- forward()
- end
- end
- forward()
- forward()
- forward()
- local c = "lenis pick"
- c = c + 4
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement