Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Starting Parameters
- local var = {" X ", " Y ", " Z "}
- local jump = 1
- local origin = {}
- local dest = {}
- local disp = {}
- local minjump = {18, 8, 13}
- local maxjumpdistance = 100
- local maxjump = {}
- local jumpdist = {}
- local jumplog = {}
- for i = 1, 3 do
- maxjump[i] = minjump[i] + maxjumpdistance
- end
- -- Determining Journey
- for t = 1, 3 do
- term.setCursorPos(1,t)
- term.write("Enter" .. var[t] .. "coord of origin: ")
- origin[t] = read()
- end
- term.clear()
- for t = 1, 3 do
- term.setCursorPos(1,t)
- term.write("Enter" .. var[t] .. "coord of destination")
- dest[t] = read()
- end
- term.clear()
- for t = 1,3 do
- disp[t] = dest[t] - origin[t]
- end
- -- Calculating Jumps
- while disp ~= {0, 0, 0} do
- for t = 1, 3 do
- fctr = math.abs(disp[t])/disp[t]
- jumpdist[t] = fctr*math.min(maxjump[t],math.abs(disp[t]))
- if jumpdist[t] ~= 0 and math.abs(jumpdist[t]) < minjump[t] then
- jumpdist[t] = fctr*(math.abs(disp[t]) + minjump[t])
- end
- disp[t] = disp[t] - jumpdist[t]
- end
- print(jumpdist[1] .. ", " .. jumpdist[2] .. ", " .. jumpdist[3])
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement