local min, max = 1, 1000000000 io.write("? " .. min .. "\n") io.flush() local ret = io.read() if(ret == "1") then io.write("! " .. min .. "\n") io.flush() else while(min ~= max) do local mid = math.ceil((min + max) / 2) io.write("? " .. mid .. "\n") io.flush() ret = io.read() if(ret == "1") then max = mid - 1 else min = mid end end io.write("! " .. min .. "\n") io.flush() end