genshin-wish-export
genshin-wish-export copied to clipboard
建议增加一个统计歪/不歪多少次的功能
逻辑大概是这样
from json import load
from time import strptime
#以下出现在限定池up里,但实际是常驻角色
temp2const = {'刻晴': ('2021-02-17 18:00:00', '2021-03-02 15:59:59'),
'提纳里': ('2022-08-24 7:00:00', '2022-09-09 17:59:00'),
'迪希雅': ('2023-03-01 7:00:00', '2023-03-21 17:59:00'),
}
#常驻
consts = {'迪卢克', '琴', '刻晴', '莫娜', '七七', '提纳里', '迪希雅'}
#此次抽到的角色是否属于限定池中特殊up的常驻角色
def timehit(name, this_time):
if name not in temp2const:
return False
this_time = strptime(this_time, "%Y-%m-%d %H:%M:%S")
times_start = strptime(temp2const[name][0], "%Y-%m-%d %H:%M:%S")
times_end = strptime(temp2const[name][1], "%Y-%m-%d %H:%M:%S")
if times_start <= this_time <= times_end:
return True
return False
#userdata里保存的json记录
with open('gacha-list.json', 'r', encoding='utf-8') as f:
record_json = load(f)
record = record_json['result'][0][1]
record = list(filter(lambda l: l[3] == 5, record))
win_count = fail_count = 0
guarantee = False
for each in record:
if each[1] in consts and not timehit(each[1], each[0]):
fail_count += 1
guarantee = True
elif not guarantee:
win_count += 1
else:
guarantee = False
print("不歪次数:{}\n歪的次数:{}\n小保底不歪概率:{}".format(win_count, fail_count, win_count / (fail_count + win_count)))