Mine: fix move

This commit is contained in:
Théophile Bastian 2020-08-18 18:38:51 +02:00
parent e806819475
commit fb47e96955

View file

@ -68,24 +68,28 @@ end
function go_to(dh, dd, ds) function go_to(dh, dd, ds)
go_to_depth(0) go_to_depth(0)
while height > dh do if height ~= dh then
turtle.down() while height > dh do
height = height - 1 turtle.down()
end height = height - 1
while height < dh do end
turtle.up() while height < dh do
height = height + 1 turtle.up()
height = height + 1
end
end end
turn_abs(1) if side ~= ds then
turn_abs(1)
while side > ds do while side > ds do
turtle.back() turtle.back()
side = side - 1 side = side - 1
end end
while side < ds do while side < ds do
turtle.forward() turtle.forward()
side = side + 1 side = side + 1
end
end end
go_to_depth(dd) go_to_depth(dd)
@ -135,7 +139,7 @@ function find_next_shaft()
while true do while true do
print("Climb") print("Climb")
for hei=0,MAX_HEIGHT-1 do for hei=1,MAX_HEIGHT-1 do
if (hei % 3) == 0 then if (hei % 3) == 0 then
if turtle.detect() then if turtle.detect() then
return return