local isend = "Merry Christmas!" local function query(str) io.write(str .. "\n") io.flush() local ret = io.read("*l") if ret == isend then os.exit() end return ret end local s = io.read() while s == "0" do s = query("L") end while s ~= "0" do s = query("F") end while s == "0" do s = query("R") end while true do if s == "0" then s = query("L") if s == "0" then while s == "0" do s = query("R") end end s = query("F") else s = query("L") if s == "0" then s = query("R") s = query("F") else s = query("F") end end end