Difference between revisions of "Code: Malta Islands; sowseed guidance.py"

From BlogNomic Wiki
Jump to navigation Jump to search
Line 23: Line 23:
 
     if appearAmt is None:
 
     if appearAmt is None:
 
         appearAmt = 0
 
         appearAmt = 0
     pX = round(appearAmt/totalAmt, 4) #pX = P(X|total); eX = E(X|total, payoff)
+
     pX = round(appearAmt/totalAmt, 4) #pX = P(X|total); eX = P(X|total) x payoff
 
     eX = round(pX * payoff, 4)
 
     eX = round(pX * payoff, 4)
 
     print("Expected Value of " + str(i) + " (" + str(appearAmt) + "): " + str(pX) + " / " + str(eX))
 
     print("Expected Value of " + str(i) + " (" + str(appearAmt) + "): " + str(pX) + " / " + str(eX))

Revision as of 13:18, 6 February 2023

import collections as col

deck = input("Please enter the current Dice Deck: ")
cleanedDeck = deck.replace(" ", "").split(",")
dictDeck = {}
valueDeck = {}
totalAmt = 0
payoff = 0
for i in cleanedDeck:
    totalAmt = totalAmt + 1
    if i not in dictDeck:
        dictDeck[i] = 1
    else:
        dictDeck[i] = dictDeck[i] + 1
for i in range(2, 13):
    if i == 2 or i == 12:
        payoff = 5
    elif i == 3 or i == 11:
        payoff = 2
    else:  
        payoff = 1
    appearAmt = dictDeck.get(str(i))
    if appearAmt is None:
        appearAmt = 0
    pX = round(appearAmt/totalAmt, 4) #pX = P(X|total); eX = P(X|total) x payoff
    eX = round(pX * payoff, 4)
    print("Expected Value of " + str(i) + " (" + str(appearAmt) + "): " + str(pX) + " / " + str(eX))
    valueDeck[i] = eX

def desendingSortDictKey(item):
    return -item[1] #oof reverse = true @ 33 suffices

cleanedProcValue = sorted(valueDeck.items(), key=desendingSortDictKey)
print(cleanedProcValue)
pt = 0
print("---Good Values---")
for i in cleanedProcValue:
    if i[0] != 7:
        pt = pt + 1
        print("Good number " + str(pt) + " at " + str(i[0]) + " have a expected value of " + str(i[1]))
        if pt >= 7: #make 7 numbers to reference if you cannot fully optimize
            break


Wrote by User:Chiiika to automate calculation of eV of a specific drop. Code is in Python.