Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- print("-----------------------------------")
- print("--------- Reactor Output ----------")
- print("----- Optimization Controller -----")
- print("-----------------------------------")
- print("")
- minInsertion = 0
- maxInsertion = 100
- URL = "http://br.sidoh.org/api/simulate?definition="
- print("Input json stringified reactor defintion: ")
- def = io.read()
- def = string.gsub(def, ""controlRodInsertion":%d+", "replaceMentPos")
- print("Steam output wanted:")
- output = io.read()
- searchingForInsertionPoints = true
- curInsertion = 100
- while searchingForInsertionPoints do
- asdf = string.gsub(def, "replaceMentPos", ""controlRodInsertion":" .. curInsertion)
- retStr = http.get(URL .. asdf).readAll()
- -- retStr = "asdfasdf;lkj;alksjdf"output":1234"
- --get output
- for stmOutStr in string.gmatch(retStr, ""output":%d+") do
- steam = string.match(stmOutStr, "%d*")
- print(curInsertion)
- print(steam)
- end
- --compare
- curInsertion = curInsertion - 1
- if curInsertion == -1 then
- searchingForInsertionPoints = false
- end
- os.sleep(1.5)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement