Skip to content
Snippets Groups Projects
Commit 6fe5b6e2 authored by Rodrigo Amaral's avatar Rodrigo Amaral
Browse files

V1.4

parent 13991ae8
No related branches found
No related tags found
No related merge requests found
...@@ -159,6 +159,7 @@ function Go_Home() ...@@ -159,6 +159,7 @@ function Go_Home()
end end
end end
if Is_Even(CURRENT_LAYER) then
--Move to 0th Row --Move to 0th Row
for i=0,CURRENT_ROW-1,1 do for i=0,CURRENT_ROW-1,1 do
r, err = turtle.forward() r, err = turtle.forward()
...@@ -179,6 +180,30 @@ function Go_Home() ...@@ -179,6 +180,30 @@ function Go_Home()
return -3 return -3
end end
end end
turtle.turnLeft()
else
--Move to 0th column
turtle.turnRight()
for i=0,CURRENT_COL-1,1 do
r, err = turtle.forward()
if(not r) then
print(err)
print("3: GO HOME CRITICAL ERROR: Unable to move Forwards!!!")
return -3
end
end
turtle.turnLeft()
--Move to 0th Row
for i=0,CURRENT_ROW-1,1 do
r, err = turtle.forward()
if(not r) then
print(err)
print("2: GO HOME CRITICAL ERROR: Unable to move Forwards!!!")
return -2
end
end
end
-- Move 0th Layer -- Move 0th Layer
for i=1,CURRENT_LAYER-1,1 do for i=1,CURRENT_LAYER-1,1 do
...@@ -190,8 +215,6 @@ function Go_Home() ...@@ -190,8 +215,6 @@ function Go_Home()
end end
end end
turtle.turnLeft()
return 0 return 0
end end
...@@ -210,6 +233,7 @@ function Go_Back() ...@@ -210,6 +233,7 @@ function Go_Back()
end end
end end
if Is_Even(CURRENT_COL) then
-- Move to previous Column -- Move to previous Column
turtle.turnRight() turtle.turnRight()
for i=0,CURRENT_COL-1,1 do for i=0,CURRENT_COL-1,1 do
...@@ -220,9 +244,9 @@ function Go_Back() ...@@ -220,9 +244,9 @@ function Go_Back()
return -3 return -3
end end
end end
turtle.turnLeft()
--Move to previous Row --Move to previous Row
turtle.turnLeft()
for i=0,CURRENT_ROW-1,1 do for i=0,CURRENT_ROW-1,1 do
r, err = turtle.forward() r, err = turtle.forward()
if(not r) then if(not r) then
...@@ -231,6 +255,29 @@ function Go_Back() ...@@ -231,6 +255,29 @@ function Go_Back()
return -2 return -2
end end
end end
else
--Move to previous Row
for i=0,CURRENT_ROW-1,1 do
r, err = turtle.forward()
if(not r) then
print(err)
print("2: GO HOME CRITICAL ERROR: Unable to move Forwards!!!")
return -2
end
end
-- Move to previous Column
turtle.turnRight()
for i=0,CURRENT_COL-1,1 do
r, err = turtle.forward()
if(not r) then
print(err)
print("3: GO BACK CRITICAL ERROR: Unable to move Forwards!!!")
return -3
end
end
turtle.turnLeft()
end
-- Move one layer down -- Move one layer down
if(CURRENT_LAYER > 0) then if(CURRENT_LAYER > 0) then
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment