Getting Started
Rules
Character Mover
Optimization Guide
EZ Wiki
EZ Guide
Magelo
Zone List
Spell Recipes
T10.5 Spell Recipes
Crafting Recipes
Donate
EZ Player Discord
EZ Server Files
EZ Client Downloads
Custom UF MiniMap
Custom UF Inventory
EQEmulator Home
Allakhazam Home
UFMissingFilesList
TwitchTV
import randomimport sys# The number of crystals trials start with.StartMinor = 100StartLesser = 20StartGreater = 0StartMajor = 0# The chance a gamble succeeds.Chance = 33class Trial: mInitialValue = 0 mMinor = 0 mTotalMinorGambles = 0 mMinorWin = 0 mTotalMinorLose = 0 mLesser = 0 mTotalLesserGambles = 0 mLesserWin = 0 mLesserLose = 0 mGreater = 0 mMajor = 0 mGain = 0 def __init__(self, pMinor, pLesser, pGreater, pMajor) : self.mMinor = pMinor self.mLesser = pLesser self.mGreater = pGreater self.mMajor = pMajor self.mInitialValue = self.getTotalValue() def getMinorValue(self): return self.mMinor * 2000 def getLesserValue(self): return self.mLesser * 4000 def getGreaterValue(self): return self.mGreater * 10000 def getMajorValue(self): return self.mMajor * 20000 def getTotalValue(self): return self.getMinorValue() + self.getLesserValue() + self.getGreaterValue() + self.getMajorValue() def getInitialValue(self): return self.mInitialValue def roll(self): return random.randint(0, 99) < Chance def run(self): # Gamble minor crystals. while self.mMinor > 1: self.mTotalMinorGambles += 1 # we lose 2 minor and gain a greater. if self.roll(): self.mMinor -= 2 self.mGreater += 1 self.mMinorWin += 1 # we lose 1 minor. else: self.mMinor -= 1 self.mTotalMinorLose += 1 # Gamble lesser crystals. while self.mLesser > 1: self.mTotalLesserGambles += 1 # we lose 2 lesser and gain a major if self.roll(): self.mLesser -= 2 self.mMajor += 1 self.mLesserWin += 1 # we lose 1 lesser. else: self.mLesser -= 1 self.mLesserLose += 1 self.mGain = self.getTotalValue() - self.mInitialValue def printResults(self): print("Initial Value: " + str(self.mInitialValue)) print("Final Value: " + str(self.getTotalValue())) print("Value Difference: " + str(self.getTotalValue() - self.mInitialValue)) print("Minor Attempts: " + str(self.mTotalMinorGambles)) print("Minor Win: " + str(self.mMinorWin) + " (%.2f%%)" % (self.mMinorWin / self.mTotalMinorGambles * 100)) print("Minor Lose: " + str(self.mTotalMinorLose) + " (%.2f%%)" % (self.mTotalMinorLose / self.mTotalMinorGambles * 100)) print("Lesser Attempts: " + str(self.mTotalLesserGambles)) print("Lesser Win: " + str(self.mLesserWin) + " (%.2f%%)" % (self.mLesserWin / self.mTotalLesserGambles * 100)) print("Lesser Lose: " + str(self.mLesserLose) + " (%.2f%%)" % (self.mLesserLose / self.mTotalLesserGambles * 100))class MultiTrial: mNumTrials = 0 mTotalMinorGambles = 0 mMinMinorGambles = sys.maxsize mMaxMinorGambles = -sys.maxsize mTotalMinorWin = 0 mMinMinorWin = sys.maxsize mMaxMinorWin = -sys.maxsize mTotalMinorLose = 0 mMinMinorLose = sys.maxsize mMaxMinorLose = -sys.maxsize mTotalLesserGambles = 0 mMinLesserGambles = sys.maxsize mMaxLesserGambles = -sys.maxsize mTotalLesserWin = 0 mMinLesserWin = sys.maxsize mMaxLesserWin = -sys.maxsize mTotalLesserLose = 0 mMinLesserLose = sys.maxsize mMaxLesserLose = -sys.maxsize mIncreased = 0 mDecreased = 0 mInitialValue = 0 mFinalValue = 0 mMinFinalValue = sys.maxsize mMaxFinalValue = 0 def __init__(self, pNumTrials): self.mNumTrials = pNumTrials def addResults(self, pTrial): ## ## Minor Gambles ## self.mTotalMinorGambles += pTrial.mTotalMinorGambles # Record min minor gambles. if self.mMinMinorGambles > pTrial.mTotalMinorGambles: self.mMinMinorGambles = pTrial.mTotalMinorGambles # Record max minor gambles. if self.mMaxMinorGambles < pTrial.mTotalMinorGambles: self.mMaxMinorGambles = pTrial.mTotalMinorGambles self.mTotalMinorWin += pTrial.mMinorWin # Record min minor win. if self.mMinMinorWin > pTrial.mMinorWin: self.mMinMinorWin = pTrial.mMinorWin # Record max minor win. if self.mMaxMinorWin < pTrial.mMinorWin: self.mMaxMinorWin = pTrial.mMinorWin self.mTotalMinorLose += pTrial.mTotalMinorLose # Record min minor lose. if self.mMinMinorLose > pTrial.mTotalMinorLose: self.mMinMinorLose = pTrial.mTotalMinorLose # Record max minor lose. if self.mMaxMinorLose < pTrial.mTotalMinorLose: self.mMaxMinorLose = pTrial.mTotalMinorLose ## ## Lesser Gambles ## self.mTotalLesserGambles += pTrial.mTotalLesserGambles # Record min lesser gambles. if self.mMinLesserGambles > pTrial.mTotalLesserGambles: self.mMinLesserGambles = pTrial.mTotalLesserGambles # Record max lesser gambles. if self.mMaxLesserGambles < pTrial.mTotalLesserGambles: self.mMaxLesserGambles = pTrial.mTotalLesserGambles self.mTotalLesserWin += pTrial.mLesserWin # Record min lesser win. if self.mMinLesserWin > pTrial.mLesserWin: self.mMinLesserWin = pTrial.mLesserWin # Record max lesser win. if self.mMaxLesserWin < pTrial.mLesserWin: self.mMaxLesserWin = pTrial.mLesserWin self.mTotalLesserLose += pTrial.mLesserLose # Record min lesser lose. if self.mMinLesserLose > pTrial.mLesserLose: self.mMinLesserLose = pTrial.mLesserLose # Record max lesser lose. if self.mMaxLesserLose < pTrial.mLesserLose: self.mMaxLesserLose = pTrial.mLesserLose self.mInitialValue += pTrial.mInitialValue self.mFinalValue += pTrial.getTotalValue() # Record number of trials that resulted in an increase. (or even) if pTrial.getTotalValue() >= pTrial.getInitialValue(): self.mIncreased += 1 # Record trials that resulted in a decrease. if pTrial.getTotalValue() < pTrial.getInitialValue(): self.mDecreased += 1 if pTrial.getTotalValue() < self.mMinFinalValue: self.mMinFinalValue = pTrial.getTotalValue() if pTrial.getTotalValue() > self.mMaxFinalValue: self.mMaxFinalValue = pTrial.getTotalValue() def run(self): for i in range(0, self.mNumTrials): t = Trial(StartMinor, StartLesser, StartGreater, StartMajor) t.run() self.addResults(t) def printResults(self): print("Total Trials: " + format(self.mNumTrials, ",d")); print("Average Initial AA: " + format(int(self.mInitialValue / self.mNumTrials), ",d")) print("Average Final AA: " + format(int(self.mFinalValue / self.mNumTrials), ",d")) print("Worst Final AA: " + format(int(self.mMinFinalValue), ",d")) print("Best Final AA: " + format(int(self.mMaxFinalValue), ",d")) print("Total Increase: " + format(int(self.mIncreased), ",d") + " (%.2f%%)" % (self.mIncreased / self.mNumTrials * 100)) print("Total Decrease: " + format(int(self.mDecreased), ",d") + " (%.2f%%)" % (self.mDecreased / self.mNumTrials * 100)) print("") print("--- Minor Gambles ---") print("Total: " + format(int(self.mTotalMinorGambles), ",d")) print("Average: " + format(int(self.mTotalMinorGambles / self.mNumTrials), ",d")) print("Min: " + format(int(self.mMinMinorGambles), ",d")) print("Max: " + format(int(self.mMaxMinorGambles), ",d")) print("--- Minor Gambles (Win) ---") print("Total: " + format(int(self.mTotalMinorWin), ",d") + " (%.2f%%)" % (self.mTotalMinorWin / self.mTotalMinorGambles * 100)) print("Average: " + format(int(self.mTotalMinorWin / self.mNumTrials), ",d")) print("Min: " + format(int(self.mMinMinorWin), ",d")) print("Max: " + format(int(self.mMaxMinorWin), ",d")) print("--- Minor Gambles (Lose) ---") print("Total: " + format(int(self.mTotalMinorLose), ",d") + " (%.2f%%)" % (self.mTotalMinorLose / self.mTotalMinorGambles * 100)) print("Average: " + format(int(self.mTotalMinorLose / self.mNumTrials), ",d")) print("Min: " + format(int(self.mMinMinorLose), ",d")) print("Max: " + format(int(self.mMaxMinorLose), ",d")) print("") print("--- Lesser Gambles ---") print("Total: " + format(int(self.mTotalLesserGambles), ",d")) print("Average: " + format(int(self.mTotalLesserGambles / self.mNumTrials), ",d")) print("Min: " + format(int(self.mMinLesserGambles), ",d")) print("Max: " + format(int(self.mMaxLesserGambles), ",d")) print("--- Lesser Gambles (Win) ---") print("Total: " + format(int(self.mTotalLesserWin), ",d") + " (%.2f%%)" % (self.mTotalLesserWin / self.mTotalLesserGambles * 100)) print("Average: " + format(int(self.mTotalLesserWin / self.mNumTrials), ",d")) print("Min: " + format(int(self.mMinLesserWin), ",d")) print("Max: " + format(int(self.mMaxLesserWin), ",d")) print("--- Lesser Gambles (Lose) ---") print("Total: " + format(int(self.mTotalLesserLose), ",d") + " (%.2f%%)" % (self.mTotalLesserLose / self.mTotalLesserGambles * 100)) print("Average: " + format(int(self.mTotalLesserLose / self.mNumTrials), ",d")) print("Min: " + format(int(self.mMinLesserLose), ",d")) print("Max: " + format(int(self.mMaxLesserLose), ",d")) mt = MultiTrial(1000000)mt.run()mt.printResults()