Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- os.loadAPI("findBlocks.lua")
- os.loadAPI("userInput.lua")
- cost = 0
- function setCost(newCost)
- cost = newCost
- end
- function getCost()
- return cost
- end
- function predictFloor(newlength, newwidth)
- width = tonumber(newwidth)
- length = tonumber(newlength)
- print(width)
- print(length)
- for i = 1, length do
- for j = 1, width do
- if j < width then
- cost = cost + 1
- end
- end
- if i < length then
- if i % 2 == 0 then
- cost = cost + 1
- else
- cost = cost + 1
- end
- end
- end
- end
- function predictWalls(newlength, newwidth, newHeight)
- width = tonumber(newwidth - 2)
- length = tonumber(newlength - 2)
- height = tonumber(newHeight)
- distance = 0
- for i = 1, 4 do
- if i % 2 == 1 then
- distance = length
- else
- distance = width
- end
- for j = 1, distance do
- cost = cost + 1
- for k = 1, height do
- cost = cost + 1
- end
- predictSupportBeam(height)
- end
- cost = cost + 1
- end
- end
- function predictSupportBeam(newHeight)
- height = tonumber(newHeight)
- cost = cost + 1
- for j = 1, height do
- if j < height then
- cost = cost + 1
- end
- end
- end
- function predictSupportBeams(height, orientation)
- width = width - 1
- length = length - 1
- for i = 1, 4 do
- predictSupportBeam(height)
- distance = 0
- if i % 2 == 1 and i ~= 4 then
- distance = length
- end
- if i % 2 == 0 and i ~= 4 then
- distance = width
- end
- for j = 1, distance do
- cost = cost + 1
- end
- for k = 1, height do
- cost = cost + 1
- end
- end
- if orientation == 0 then
- for l = 1, length do
- cost = cost + 1
- end
- else
- for l = 1, width do
- cost = cost + 1
- end
- for m = 1, length do
- cost = cost + 1
- end
- end
- end
- function setOrientation(newWidth)
- newwidth = tonumber(newWidth)
- orientation = 0
- if newwidth % 2 == 1 then
- orientation = 0
- else
- orientation = 1
- end
- end
- function predictFullBuild(newlength, newwidth, height)
- cost = cost + 1
- predictFloor(newwidth, newlength)
- setOrientation(newwidth)
- predictSupportBeams(height, orientation)
- predictWalls(newlength, newwidth, height)
- turtle.select(1)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement