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")