Untitled

mail@pastecode.io avatar
unknown
plain_text
2 years ago
2.2 kB
9
Indexable
Never
import random

pocetSimulaci = 2500
pocetWantedOOP = 4
pocetOstatnichOOP = 60
pocetGoldu = 110
kolikChybiDoTrojkove = 5
level = 7
costHledanehoChampiona = 3

oddsPole = [[100,0,0,0,0],
            [100,0,0,0,0],
            [75,25,0,0,0],
            [55,30,15,0,0],
            [45,33,20,2,0],
            [25,40,30,5,0],
            [19,30,35,15,1],
            [15,20,35,25,5],
            [10,15,30,30,15],
            [5,10,20,40,25],
            [1,2,12,50,35]]

velikostPoolu = [29,22,18,12,10]
pocetChampionuVCostu = [13,13,13,11,9]

pocetNalezenychJednotek = [0,0,0,0,0,0,0,0,0,0]

for x in range(pocetSimulaci):
    pocetVsehoOOP = pocetWantedOOP + pocetOstatnichOOP
    pocetWantedIP = velikostPoolu[costHledanehoChampiona-1] - pocetWantedOOP
    pocetVsehoIP = pocetChampionuVCostu[costHledanehoChampiona-1] * velikostPoolu[costHledanehoChampiona-1] - pocetVsehoOOP
    pocetNalezenychVSimulaci = 0
    aktualniGoldy = pocetGoldu
    while (aktualniGoldy >= 2 + costHledanehoChampiona):
        if pocetNalezenychVSimulaci == 9:
            break
        aktualniGoldy -= 2
        for _ in range(5):
            if pocetNalezenychVSimulaci == 9:
                break
            costRoll = random.randrange(1,100)
            if costRoll <= oddsPole[level-1][costHledanehoChampiona-1]:
                championRoll = random.randrange(1,pocetVsehoIP)
                if championRoll <= pocetWantedIP:
                    pocetNalezenychVSimulaci += 1
                    pocetWantedIP -= 1
                    pocetVsehoIP -= 1
                    aktualniGoldy -= costHledanehoChampiona

    pocetNalezenychJednotek[pocetNalezenychVSimulaci] += 1


for u in range(len(pocetNalezenychJednotek)):
    print(str(u) + " " + str(pocetNalezenychJednotek[u]))

print("")
for u in range(len(pocetNalezenychJednotek)):
    print(str(u),end = ' ')
    for _ in range (200*pocetNalezenychJednotek[u]//pocetSimulaci):
        print("|",end='')
    print("")



soucet = 0
for y in range (kolikChybiDoTrojkove):
    soucet += pocetNalezenychJednotek[y]
procento = (1 - soucet / pocetSimulaci) * 100
print("Šance na 3* je: " + str(procento) + "%")