This commit is contained in:
Kai Vogelgesang 2020-07-08 13:12:46 +02:00
parent 6ca1ac6f7b
commit 7639e0c178

30
kai/home.lua Normal file
View File

@ -0,0 +1,30 @@
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, 0, "+z")