pythonシミュレーション陰陽師抽選

9425 ワード

python菜鳥一枚で今回鈴鹿御前を百抽で解決できるかどうか見てみましょう
#!/usr/bin/python3
#coding:utf-8
import random
import time

dict = {'up':0,'ssr':0,'sr':0,'r':0,'time':0}
def chou (dict):
    a = random.randint(1, 10000);
    if dict['ssr'] <3:
        ssrgailv = 250
    else:
        ssrgailv = 100
    if a <= ssrgailv:
        dict['ssr']+=1
        gailv =(int(dict['time']/50)*5+15)    
        l = random.randint(1, 100)
        if l <= gailv:
            dict['up']+=1
            print('ssr     ')
        else:
            print('ssr   ')
    elif a >= 8000:
        dict['sr']+=1
        print('  sr')
    else:
        dict['r']+=1
        '''print('  r  ')'''
    
def printka(dict):
    print('    :'+str(dict['time'])+',ssrUp-'+str(dict['up'])+',ssr-'+str(dict['ssr'])+',sr-'+str(dict['sr'])+',r-'+str(dict['r']))

count = input("      ?  1 10")

while dict['up'] == 0 :
    for i in range(int(count)):
        chou(dict)
    dict['time']+=int(count)
printka(dict)