turtles/kai/home.lua
Kai Vogelgesang 88a94caf74 Oof
2020-07-08 13:17:03 +02:00

30 lines
651 B
Lua

local T = require("lib")
local function greedy_move(x, z, o)
print("Move Target: " .. x .. "," .. z .. " (" .. o .. ")")
if z ~= T.state.z then
if z > T.state.z then
T.rotateTowards("+z")
else
T.rotateTowards("-z")
end
for _ = 1, math.abs(z - T.state.z) do
T.fwd()
end
end
if x ~= T.state.x then
if x > T.state.x then
T.rotateTowards("+x")
else
T.rotateTowards("-x")
end
for _ = 1, math.abs(x - T.state.x) do
T.fwd()
end
end
T.rotateTowards(o)
end
greedy_move(0, 0, "+z")