Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local temp = 20
- local fuel = 0
- local hp = true
- local hpname = "HP"
- local size = 36
- local ticks = 0
- local hplp_div = 0
- local maxtemp = 1000
- local heatstep = 0.05
- local fuelvalue = {1000, 1600, 1600, 3200, 6400, 3200, 32000, 96000}
- local fuelname = {"Bucket of Lava", "Charcoal", "Forestry Peat", "Coal", "Coal Coke", "Creosote Oil", "Forestry Bio Fuel", "Buildcraft Fuel"}
- --user input
- print("Which Fuel will you use?")
- for i = 1,#fuelname do
- print(i..") "..fuelname[i])
- end
- local fuelindex = tonumber(io.read())
- print("What size of Boiler will you use? (1,8,12,18,27,36)")
- size = tostring(io.read())
- local answer = ""
- while not ((answer == "h") or (answer == "H") or (answer == "l") or (answer == "L")) do
- print("(H)igh or (L)ow Pressure?")
- answer = io.read()
- end
- if (answer == "h") or (answer == "H") then hp = true else hp = false end
- if hp then maxtemp = 1000 else maxtemp = 500 end
- if hp then hplp_div = 8 else hplp_div = 16 end
- while temp < maxtemp do
- --calculate fuel for tick
- local deltafuel = ((6.4 - size * 0.08) / hplp_div) * size * (1 + 8 * (1 - temp / maxtemp))
- fuel = fuel + deltafuel
- --calculate heat change
- local heatchange = heatstep
- if temp < .25*maxtemp then
- heatchange = heatchange + heatstep
- end
- if temp < .5*maxtemp then
- heatchange = heatchange + heatstep
- end
- if temp < .75*maxtemp then
- heatchange = heatchange + heatstep
- end
- heatchange = heatchange / size
- temp = temp + heatchange
- --advance ticks
- ticks = ticks + 1
- --print("tick "..ticks.." temp: "..temp.." C fuel used: "..fuel)
- end
- local constantfuel = ((6.4 - size * 0.08) / hplp_div) * size * 20 * 3600 / fuelvalue[fuelindex]
- if hp then hpname = size.."HP" else hpname = size.."LP" end
- print(hpname.." takes "..tostring(ticks/20).." seconds ("..tostring(ticks).." ticks) and "..tostring(fuel/fuelvalue[fuelindex]).." "..fuelname[fuelindex].." to heat up.")
- print("It will require "..tostring(constantfuel).." "..fuelname[fuelindex].." per hour once at max heat.")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement