Jump to content

Schroedingers_Hat

Vintarian
  • Posts

    1
  • Joined

  • Last visited

Everything posted by Schroedingers_Hat

  1. If I didn't make any dumb errors, this is a depth first in python search to find highest survival for a target power, or the highest power for a given survival. Credit to swifteralex for the nice summary and writing it down as a recurrence relation: def lerp(a, b, t): return a * (1 - t) + b * t initial = { "power": 0, "shatter": 0, "quench": 0, "temper": 0, "survival": 1, "history": "", } def quench(state_in): state = {} state["history"] = state_in["history"] + "Q" state["survival"] = state_in["survival"] * (1 - state_in["shatter"]) state["shatter"] = state_in["shatter"] + 0.05 state["power"] = state_in["power"] + 0.1 / (1.0 + 0.2 * state_in["quench"]) state["quench"] = state_in["quench"] + 1 state["temper"] = state_in["temper"] return state def temper(state_in): effectiveness = 1.0 / (1.0 + 0.05 * state_in["temper"]) state = {} state["history"] = state_in["history"] + "T" state["quench"] = state_in["quench"] state["survival"] = state_in["survival"] state["shatter"] = state_in["shatter"] * lerp(1.0, 0.8, effectiveness) state["power"] = state_in["power"] * lerp(1.0, 0.92, effectiveness) state["temper"] = state_in["temper"] + 1 return state def work(state_in, min_survival=1 / 2): # Function to recursively work the item by quenching or tempering. # First quench is free, always do it. if state_in["quench"] == 0: return work(quench(state_in), min_survival) # Heuristic of maximum for tempers of 4 or 1/4th of quenches. # Forces running in polynomial time. # Results matched empirically, but you'd take it out for general correctness. if state_in["survival"] <= min_survival or state_in["temper"] >= max( min(4, state_in["quench"]), state_in["quench"] / 4 ): return state_in worked_1 = work(quench(state_in), min_survival) worked_2 = work(temper(state_in), min_survival) if worked_1["power"] >= worked_2["power"]: # I think you can't ever get back to where we are if we overshot. if worked_1["survival"] <= min_survival: return state_in return worked_1 if worked_1["survival"] <= min_survival: return state_in return worked_2 def power(state_in, min_power=0.5, min_survival=0.2): if state_in["quench"] == 0: return power(quench(state_in), min_power, min_survival) # Need additional base case for min survival to avoid fruitless paths. if state_in["power"] >= min_power or state_in["survival"] < min_survival: return state_in worked_1 = power(quench(state_in), min_power, min_survival) # Same heuristic. if state_in["temper"] >= max(min(state_in["quench"], 4), state_in["quench"] / 2): return worked_1 worked_2 = power(temper(state_in), min_power, min_survival) if worked_1["survival"] >= worked_2["survival"]: return worked_1 else: return worked_2 for w in range(0, 9): print(f"Best strategy for {2**w} ingots", work(initial, 1 / 2**w)) for p in range(3, 15): print( f"Best strategy for achieving at least {p * 0.05:.2f} power", power(initial, p * 0.05, 0.001), ) state = initial for q in range(20): state = quench(state) print("YOLO strategy", state) I added a couple of heuristics after observing on the first run that it didn't temper very much. It seems to strongly prefer doing one or two tempers early and doing one or two quenches between tempers, which roughly matched my intuition. The 'for ingots' also isn't technically quite optimal. Specifically it would be optimising for finishing on average with k/n weapons given you start with k ingots. The true optimal strategy for finishing with one tool will change with each quench based on how you roll your shatters and requires deeper analysis. It won't be very different though. Output: Best strategy for 1 ingots {'history': 'Q', 'survival': 1, 'shatter': 0.05, 'power': 0.1, 'quench': 1, 'temper': 0} Best strategy for 2 ingots {'history': 'QQTQTQQQ', 'survival': 0.5250374484694957, 'shatter': 0.2552380952380952, 'power': 0.38985782312925177, 'quench': 6, 'temper': 2} Best strategy for 4 ingots {'history': 'QQTQTQQQQQ', 'survival': 0.2716712818058456, 'shatter': 0.3552380952380952, 'power': 0.4769790352504639, 'quench': 8, 'temper': 2} Best strategy for 8 ingots {'history': 'QQTQQQQQQQ', 'survival': 0.14359332481401604, 'shatter': 0.42999999999999994, 'power': 0.5337335442335444, 'quench': 9, 'temper': 1} Best strategy for 16 ingots {'history': 'QQQQQQQQQQ', 'survival': 0.06547290750000002, 'shatter': 0.49999999999999994, 'power': 0.5841144966144967, 'quench': 10, 'temper': 0} Best strategy for 32 ingots {'history': 'QQQQQQQQQQQ', 'survival': 0.03273645375000001, 'shatter': 0.5499999999999999, 'power': 0.61744782994783, 'quench': 11, 'temper': 0} Best strategy for 64 ingots {'history': 'QQTQQQQQQQQQQ', 'survival': 0.020003698893190952, 'shatter': 0.58, 'power': 0.6340311632811634, 'quench': 12, 'temper': 1} Best strategy for 128 ingots {'history': 'QQTQQQQQQQQQQQ', 'survival': 0.0084015535351402, 'shatter': 0.63, 'power': 0.6634429279870457, 'quench': 13, 'temper': 1} Best strategy for 256 ingots {'history': 'QQQQTQQQQQQQQQQ', 'survival': 0.004221933002592695, 'shatter': 0.6600000000000001, 'power': 0.6805064200505377, 'quench': 14, 'temper': 1} Best strategy for achieving at least 0.15 power {'history': 'QTQ', 'survival': 0.96, 'shatter': 0.09000000000000001, 'power': 0.17533333333333334, 'quench': 2, 'temper': 1} Best strategy for achieving at least 0.20 power {'history': 'QTQTQ', 'survival': 0.8900571428571429, 'shatter': 0.12285714285714287, 'power': 0.2334031746031746, 'quench': 3, 'temper': 2} Best strategy for achieving at least 0.25 power {'history': 'QQQ', 'survival': 0.855, 'shatter': 0.15000000000000002, 'power': 0.2547619047619048, 'quench': 3, 'temper': 0} Best strategy for achieving at least 0.30 power {'history': 'QQTQQ', 'survival': 0.76038, 'shatter': 0.18, 'power': 0.30259523809523814, 'quench': 4, 'temper': 1} Best strategy for achieving at least 0.35 power {'history': 'QTQTQQQ', 'survival': 0.6457564380174927, 'shatter': 0.22285714285714286, 'power': 0.3514587301587302, 'quench': 5, 'temper': 2} Best strategy for achieving at least 0.40 power {'history': 'QTQTQQQQ', 'survival': 0.5018450032593086, 'shatter': 0.27285714285714285, 'power': 0.4014587301587302, 'quench': 6, 'temper': 2} Best strategy for achieving at least 0.45 power {'history': 'QQTQQQQQ', 'survival': 0.34567483104, 'shatter': 0.32999999999999996, 'power': 0.4536053391053392, 'quench': 7, 'temper': 1} Best strategy for achieving at least 0.50 power {'history': 'QTQQQQQQQ', 'survival': 0.21672647732736003, 'shatter': 0.38999999999999996, 'power': 0.5019386724386725, 'quench': 8, 'temper': 1} Best strategy for achieving at least 0.55 power {'history': 'QQTQTQQQQQQQ', 'survival': 0.10418045386413348, 'shatter': 0.45523809523809516, 'power': 0.5511548594262881, 'quench': 10, 'temper': 2} Best strategy for achieving at least 0.60 power {'history': 'QQTQQQQQQQQQ', 'survival': 0.04256106147487436, 'shatter': 0.5299999999999999, 'power': 0.6027811632811634, 'quench': 11, 'temper': 1} Best strategy for achieving at least 0.65 power {'history': 'QTQQTQQQQQQQQQQ', 'survival': 0.01098558012017472, 'shatter': 0.6133333333333334, 'power': 0.6513086876242339, 'quench': 13, 'temper': 2} Best strategy for achieving at least 0.70 power {'history': 'QQQQQQQQQQQQQQ', 'survival': 0.002062396586250001, 'shatter': 0.7000000000000001, 'power': 0.7058873724314901, 'quench': 14, 'temper': 0} And I'm not sure if LadyWYT's concerns about people grinding are going to turn out overly important. 0.66 power is about as hard as a full set of plate, and (unless I made that dumb error) no amount of grinding is going to push it much past 0.84 which puts the difference between moderate effort and using all of the iron within 10,000 chunks at about 20% extra damage. I think my biggest criticism is how little difference tempering makes vs. just YOLOing it with all quenches and agree that a more skill based/finite system would be cooler. It would also be interesting if there was a seed (or possibly even seed an location/time) based component for that last couple of percent so you would have to learn what is optimal for each world rather than looking it up on the wiki.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.