init
This commit is contained in:
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -0,0 +1 @@
|
|||||||
|
{"20230406161208000039536689612373": {"orderId": "20230406161208000039536689612373", "platform": 1, "amount": 3000, "productName": "\u6708\u5361", "payTime": "2023-04-06 16:12:19"}, "20230406161225000059062182956747": {"orderId": "20230406161225000059062182956747", "platform": 1, "amount": 3000, "productName": "\u6708\u5361", "payTime": "2023-04-06 16:12:33"}, "20230422204748000037275953981298": {"orderId": "20230422204748000037275953981298", "platform": 1, "amount": 16800, "productName": "\u6bcf\u6708\u5bfb\u8bbf\u7ec4\u5408\u5305", "payTime": "2023-04-22 20:47:57"}, "20230606085446000057642937061731": {"orderId": "20230606085446000057642937061731", "platform": 1, "amount": 3000, "productName": "\u6708\u5361", "payTime": "2023-06-06 08:54:57"}, "20230608160910000057849442448153": {"orderId": "20230608160910000057849442448153", "platform": 1, "amount": 3000, "productName": "\u6267\u88c1\u8005\u82af\u7247\u793c\u5305", "payTime": "2023-06-08 16:09:20"}, "20230705005009000057738543391207": {"orderId": "20230705005009000057738543391207", "platform": 1, "amount": 3000, "productName": "\u6708\u5361", "payTime": "2023-07-05 00:50:20"}, "20230705005027000057120734707077": {"orderId": "20230705005027000057120734707077", "platform": 1, "amount": 3000, "productName": "\u6708\u5361", "payTime": "2023-07-05 00:50:39"}, "20230705010136000017525085998075": {"orderId": "20230705010136000017525085998075", "platform": 1, "amount": 600, "productName": "\u5929\u5916\u63a2\u5bfb\u7ec4\u5408\u5305", "payTime": "2023-07-05 01:01:45"}, "20230708100023000047661171492268": {"orderId": "20230708100023000047661171492268", "platform": 1, "amount": 3000, "productName": "\u6708\u5361", "payTime": "2023-07-08 10:00:33"}, "20231003191546000037922632492942": {"orderId": "20231003191546000037922632492942", "platform": 1, "amount": 3000, "productName": "\u6708\u5361", "payTime": "2023-10-03 19:15:58"}, "20231101085130000017277916939385": {"orderId": "20231101085130000017277916939385", "platform": 1, "amount": 3000, "productName": "\u6708\u5361", "payTime": "2023-11-01 08:51:40"}, "20231203195659000036902177498018": {"orderId": "20231203195659000036902177498018", "platform": 1, "amount": 3000, "productName": "\u6708\u5361", "payTime": "2023-12-03 19:57:14"}, "20240331203232000056814987091551": {"orderId": "20240331203232000056814987091551", "platform": 1, "amount": 3000, "productName": "\u6708\u5361", "payTime": "2024-03-31 20:32:40"}, "20240331203211000056175759151497": {"orderId": "20240331203211000056175759151497", "platform": 1, "amount": 3000, "productName": "\u6708\u5361", "payTime": "2024-03-31 20:32:25"}}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
{"operator_6": ["温蒂", "早露", "铃兰", "棘刺", "森蚺", "史尔特尔", "瑕光", "泥岩", "山", "空弦", "嵯峨", "异客", "凯尔希", "卡涅利安", "帕拉斯", "水月", "琴柳", "远牙", "焰尾", "灵知", "老鲤", "澄闪", "菲亚梅塔", "号角", "艾丽妮", "黑键", "多萝西", "鸿雪", "玛恩纳", "白铁]斥罪", "焰影草", "林", "仇白", "伊内丝", "霍尔海雅", "圣约送葬人", "提丰", "琳琅诗怀雅", "涤火杰西卡", "赫德雷", "塑心", "薇薇安娜", "W", "迷迭香", "浊心斯卡蒂", "缄默德克萨斯", "归淏幽灵鲨", "耀骑士临光"], "operator_5": ["极境", "石棉", "月禾", "莱恩哈特", "断崖", "蜜蜡", "贾维", "安哲拉", "燧石", "四月", "奥斯塔", "絮雨", "卡夫卡", "爱丽丝", "乌有", "熔泉", "赤冬", "绮良", "羽毛笔", "桑葚", "灰毫", "蚀清", "极光", "夜半", "夏栎", "风丸", "洛洛", "掠风", "濯尘芙蓉", "承曦格雷伊", "晓歌", "但书", "明椒", "子月", "和弦", "火哨", "铎铃", "洋灰", "玫拉", "空构", "寒檀", "青枳", "杏仁", "刺玫", "深律"], "operator_4": ["夜烟", "远山", "杰西卡", "流星", "白雪", "清道夫", "红豆", "杜宾", "缠丸", "霜叶", "慕斯", "砾", "暗索", "末药", "调香师", "角峰", "蛇屠箱", "古米", "深海色", "地灵", "阿消", "猎蜂", "格雷伊", "苏苏洛", "桃金娘", "红云", "梅", "安比尔", "宴", "刻刀", "波登可", "卡达", "子", "酸糖", "芳汀", "泡泡", "杰克", "松果", "豆苗", "深靛", "罗比拉塔", "褐果", "铅踝", "休谟斯", "维荻"], "operator_3": ["芬", "香草", "翎羽", "玫兰莎", "卡缇", "米格鲁", "克洛丝", "炎熔", "芙蓉", "安赛尔", "史都华德", "梓兰", "空爆", "月见夜", "斑"], "limited": true, "Upper_6": {"薇薇安娜": 0.35, "塑心": 0.35}, "Upper_history_6": {"缄默德克萨斯": 5, "归淏幽灵鲨": 5, "耀骑士临光": 5}, "Upper_5": {"深律": 0.5}}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
"ObEDaT5atWTQzBws1qRn3LbC"
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
{"username": "18021026530", "password": "Mrfz1790990971"}
|
||||||
@@ -0,0 +1,234 @@
|
|||||||
|
import random
|
||||||
|
import json
|
||||||
|
import copy
|
||||||
|
import threading
|
||||||
|
import matplotlib.pyplot as plt
|
||||||
|
import time
|
||||||
|
from multiprocessing import Process, Manager
|
||||||
|
|
||||||
|
|
||||||
|
def load_banner_data(banner_name):
|
||||||
|
try:
|
||||||
|
file = open(f'data/banner_data/{banner_name}.txt', 'r', encoding='utf-8')
|
||||||
|
content = json.loads(file.read())
|
||||||
|
file.close()
|
||||||
|
return content
|
||||||
|
except FileNotFoundError:
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
def single_pull(banner_data, no_six_pull_count=0):
|
||||||
|
# Process Pity Pull
|
||||||
|
six_star_threshold = (no_six_pull_count - 50) * 2 if no_six_pull_count > 50 else 0
|
||||||
|
factor = (100 - (2 + six_star_threshold)) / 98
|
||||||
|
prob_list = [2 + six_star_threshold, 8 * factor, 50 * factor, 40 * factor]
|
||||||
|
sum_prob_list = [prob_list[0], prob_list[0] + prob_list[1], prob_list[0] + prob_list[1] + prob_list[2],
|
||||||
|
prob_list[0] + prob_list[1] + prob_list[2] + prob_list[3]]
|
||||||
|
|
||||||
|
# get star info
|
||||||
|
star_random_int = random.randint(1, 100)
|
||||||
|
if 0 < star_random_int <= sum_prob_list[0]:
|
||||||
|
result = 6
|
||||||
|
target = get_operator_consider_upper(banner_data['Upper_6'], banner_data['operator_6'],
|
||||||
|
banner_data['Upper_history_6'])
|
||||||
|
elif sum_prob_list[0] < star_random_int <= sum_prob_list[1]:
|
||||||
|
result = 5
|
||||||
|
target = get_operator_consider_upper(banner_data['Upper_5'], banner_data['operator_5'])
|
||||||
|
elif sum_prob_list[1] < star_random_int <= sum_prob_list[2]:
|
||||||
|
result = 4
|
||||||
|
target = random.choice(banner_data['operator_4'])
|
||||||
|
else:
|
||||||
|
result = 3
|
||||||
|
target = random.choice(banner_data['operator_3'])
|
||||||
|
if result == 6:
|
||||||
|
no_six_pull_count = 0
|
||||||
|
else:
|
||||||
|
no_six_pull_count += 1
|
||||||
|
return (result, target), no_six_pull_count
|
||||||
|
|
||||||
|
|
||||||
|
def get_operator_consider_upper(upper_data, operator_list, multiplex_data=None):
|
||||||
|
random_int = random.randint(1, 100)
|
||||||
|
upper_operator_list = list(upper_data.keys())
|
||||||
|
upper_operator_probability_list = [0]
|
||||||
|
new_list = copy.deepcopy(operator_list)
|
||||||
|
flag = 0
|
||||||
|
for operator in upper_operator_list:
|
||||||
|
flag += upper_data[operator] * 100
|
||||||
|
upper_operator_probability_list.append(flag)
|
||||||
|
|
||||||
|
for i in range(len(upper_operator_list)):
|
||||||
|
if upper_operator_probability_list[i] < random_int <= upper_operator_probability_list[i+1]:
|
||||||
|
return upper_operator_list[i]
|
||||||
|
|
||||||
|
if multiplex_data:
|
||||||
|
for key, value in multiplex_data.items():
|
||||||
|
for i in range(value-1):
|
||||||
|
new_list.append(key)
|
||||||
|
target = random.choice(new_list)
|
||||||
|
return target
|
||||||
|
|
||||||
|
|
||||||
|
def ten_pull(banner_data, no_six_pull_count=0):
|
||||||
|
result_list = []
|
||||||
|
is_african = True
|
||||||
|
for i in range(10):
|
||||||
|
res, no_six_pull_count = single_pull(banner_data, no_six_pull_count)
|
||||||
|
result_list.append(res)
|
||||||
|
if res[0] > 4:
|
||||||
|
is_african = False
|
||||||
|
return result_list, no_six_pull_count, is_african
|
||||||
|
|
||||||
|
|
||||||
|
def continues_pull(banner_data, total_pull):
|
||||||
|
ten_pull_count = int(total_pull / 10)
|
||||||
|
single_pull_count = ten_pull_count - ten_pull_count
|
||||||
|
no_six_pull_count = 0
|
||||||
|
african_count = 0
|
||||||
|
full_res_list = []
|
||||||
|
for i in range(ten_pull_count):
|
||||||
|
ten_pull_res, no_six_pull_count, is_african = ten_pull(banner_data, no_six_pull_count)
|
||||||
|
full_res_list += copy.deepcopy(ten_pull_res)
|
||||||
|
if is_african:
|
||||||
|
african_count += 1
|
||||||
|
|
||||||
|
for i in range(single_pull_count):
|
||||||
|
single_res, no_six_pull_count = single_pull(banner_data, no_six_pull_count)
|
||||||
|
six_star_list = [i for i in full_res_list if i[0] == 6]
|
||||||
|
|
||||||
|
# pull_result = {'Result': full_res_list, 'african': african_count, 'six star count': len(six_star_list)}
|
||||||
|
pull_result = {'african': african_count, '6 star count': len(six_star_list), '6 star list': six_star_list,
|
||||||
|
'full res': full_res_list}
|
||||||
|
return pull_result
|
||||||
|
|
||||||
|
|
||||||
|
def banner_upper_pull(banner_data):
|
||||||
|
target_dict = copy.deepcopy(banner_data['Upper_6'])
|
||||||
|
total_pull = 0
|
||||||
|
full_res_list = []
|
||||||
|
while target_dict:
|
||||||
|
res, total_pull = single_pull(banner_data, total_pull)
|
||||||
|
full_res_list.append(res)
|
||||||
|
if res[0] == 6 and res[1] in target_dict:
|
||||||
|
del target_dict[res[1]]
|
||||||
|
six_star_list = [i for i in full_res_list if i[0] == 6]
|
||||||
|
pull_result = {'total pull': len(full_res_list), '6 star count': len(six_star_list), '6 star list': six_star_list,
|
||||||
|
'full res': full_res_list}
|
||||||
|
return pull_result
|
||||||
|
|
||||||
|
|
||||||
|
def banner_upper_pull_batch_sim(banner_data, sim_count, index, res):
|
||||||
|
local_sim_result, local_statics = {}, {'6 star count': 0, 'total pull': 0}
|
||||||
|
for i in range(sim_count):
|
||||||
|
pull_data = banner_upper_pull(banner_data)
|
||||||
|
total_pull = pull_data['total pull']
|
||||||
|
if total_pull not in local_sim_result:
|
||||||
|
local_sim_result[total_pull] = 0
|
||||||
|
local_sim_result[total_pull] += 1
|
||||||
|
local_statics['6 star count'] += pull_data['6 star count']
|
||||||
|
local_statics['total pull'] += total_pull
|
||||||
|
res[index] = [local_sim_result, local_statics]
|
||||||
|
return
|
||||||
|
|
||||||
|
|
||||||
|
def given_six_star_num_pull(banner_data):
|
||||||
|
six_star_num = 6
|
||||||
|
total_pull = 0
|
||||||
|
full_res_list = []
|
||||||
|
while six_star_num > 0:
|
||||||
|
res, total_pull = single_pull(banner_data, total_pull)
|
||||||
|
full_res_list.append(res)
|
||||||
|
if res[0] == 6:
|
||||||
|
six_star_num -= 1
|
||||||
|
six_star_list = [i for i in full_res_list if i[0] == 6]
|
||||||
|
pull_result = {'total pull': len(full_res_list), '6 star count': len(six_star_list), '6 star list': six_star_list,
|
||||||
|
'full res': full_res_list}
|
||||||
|
return pull_result
|
||||||
|
|
||||||
|
|
||||||
|
def given_six_star_num_batch_sim(banner_data, sim_count, index, res):
|
||||||
|
local_sim_result, local_statics = {}, {'6 star count': 0, 'total pull': 0}
|
||||||
|
for i in range(sim_count):
|
||||||
|
pull_data = given_six_star_num_pull(banner_data)
|
||||||
|
total_pull = pull_data['total pull']
|
||||||
|
if total_pull not in local_sim_result:
|
||||||
|
local_sim_result[total_pull] = 0
|
||||||
|
local_sim_result[total_pull] += 1
|
||||||
|
local_statics['6 star count'] += pull_data['6 star count']
|
||||||
|
local_statics['total pull'] += total_pull
|
||||||
|
res[index] = [local_sim_result, local_statics]
|
||||||
|
return
|
||||||
|
|
||||||
|
|
||||||
|
def banner_upper_pull_batch_sim_vis(res, total_tries):
|
||||||
|
sim_res = {}
|
||||||
|
sim_statics = {'6 star count': 0, 'total pull': 0}
|
||||||
|
for item in res:
|
||||||
|
for key, values in item[0].items():
|
||||||
|
if key not in sim_res:
|
||||||
|
sim_res[key] = values
|
||||||
|
else:
|
||||||
|
sim_res[key] += values
|
||||||
|
for key, values in item[1].items():
|
||||||
|
sim_statics[key] += values
|
||||||
|
|
||||||
|
# 重排序
|
||||||
|
sim_res = {item[0]: item[1] for item in sorted(sim_res.items(), key=lambda x: x[0])}
|
||||||
|
# 分离键和值作为横纵坐标
|
||||||
|
x = list(sim_res.keys())
|
||||||
|
y = [pull * 10000 / total_tries for pull in sim_res.values()]
|
||||||
|
y_sum = []
|
||||||
|
sum_y = 0
|
||||||
|
for i in y:
|
||||||
|
sum_y += i / 10000
|
||||||
|
y_sum.append(sum_y)
|
||||||
|
|
||||||
|
print('Total Pull:', sim_statics["total pull"])
|
||||||
|
print('Total Six Star Count', sim_statics["6 star count"])
|
||||||
|
print('Six Star Percentage', sim_statics["6 star count"] / sim_statics["total pull"] * 100)
|
||||||
|
|
||||||
|
# 创建散点图
|
||||||
|
plt.figure(figsize=(8, 4))
|
||||||
|
# plt.scatter(x, y)
|
||||||
|
# plt.bar(x, y)
|
||||||
|
plt.subplot(2, 1, 1)
|
||||||
|
plt.plot(x, y)
|
||||||
|
plt.title("Pull count for getting both of the upper 6")
|
||||||
|
plt.ylabel("Parts per 10000")
|
||||||
|
|
||||||
|
plt.subplot(2, 1, 2)
|
||||||
|
plt.plot(x, y_sum)
|
||||||
|
plt.ylabel("Percentage")
|
||||||
|
plt.xlabel("Total Pull")
|
||||||
|
plt.grid(True)
|
||||||
|
plt.show()
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
banner = load_banner_data('宿愿')
|
||||||
|
|
||||||
|
start = time.time()
|
||||||
|
process_count = 4
|
||||||
|
process_sim = 50000
|
||||||
|
with Manager() as manager:
|
||||||
|
results = manager.list([None for i in range(process_count)]) # 创建一个长度为5的列表,用于存储结果
|
||||||
|
# 创建一个进程列表
|
||||||
|
processes = []
|
||||||
|
# 创建和启动进程
|
||||||
|
for i in range(process_count):
|
||||||
|
# process = Process(target=banner_upper_pull_batch_sim, args=(banner, process_sim, i, results))
|
||||||
|
process = Process(target=given_six_star_num_batch_sim, args=(banner, process_sim, i, results))
|
||||||
|
process.start()
|
||||||
|
processes.append(process)
|
||||||
|
|
||||||
|
# 等待所有进程完成
|
||||||
|
for process in processes:
|
||||||
|
process.join()
|
||||||
|
|
||||||
|
# 所有线程执行完成后打印执行时间
|
||||||
|
print("Done, Time:", time.time() - start)
|
||||||
|
|
||||||
|
banner_upper_pull_batch_sim_vis(results, process_count * process_sim)
|
||||||
|
# banner_upper_pull_batch_sim(banner, 1000)
|
||||||
|
pass
|
||||||
|
|
||||||
@@ -0,0 +1,105 @@
|
|||||||
|
import random
|
||||||
|
import copy
|
||||||
|
import threading
|
||||||
|
import matplotlib.pyplot as plt
|
||||||
|
from mpl_toolkits.mplot3d import Axes3D
|
||||||
|
import numpy as np
|
||||||
|
|
||||||
|
|
||||||
|
def single_pull(no_six_pull_count=0):
|
||||||
|
x = random.randint(1, 100)
|
||||||
|
six_star_threshold = (no_six_pull_count - 50) * 2 if no_six_pull_count > 50 else 0
|
||||||
|
factor = (100 - (2 + six_star_threshold)) / 98
|
||||||
|
prob_list = [2 + six_star_threshold, 8 * factor, 50 * factor, 40 * factor]
|
||||||
|
sum_prob_list = [prob_list[0], prob_list[0] + prob_list[1], prob_list[0] + prob_list[1] + prob_list[2], prob_list[0] + prob_list[1] + prob_list[2] + prob_list[3]]
|
||||||
|
if 0 < x <= sum_prob_list[0]:
|
||||||
|
result = 6
|
||||||
|
elif sum_prob_list[0] < x <= sum_prob_list[1]:
|
||||||
|
result = 5
|
||||||
|
elif sum_prob_list[1] < x <= sum_prob_list[2]:
|
||||||
|
result = 4
|
||||||
|
else:
|
||||||
|
result = 3
|
||||||
|
if result == 6:
|
||||||
|
no_six_pull_count = 0
|
||||||
|
else:
|
||||||
|
no_six_pull_count += 1
|
||||||
|
return result, no_six_pull_count
|
||||||
|
|
||||||
|
|
||||||
|
def ten_pull(no_six_pull_count=0):
|
||||||
|
result_list = []
|
||||||
|
is_african = True
|
||||||
|
for i in range(10):
|
||||||
|
res, no_six_pull_count = single_pull(no_six_pull_count)
|
||||||
|
result_list.append(res)
|
||||||
|
if res > 4:
|
||||||
|
is_african = False
|
||||||
|
return result_list, no_six_pull_count, is_african
|
||||||
|
|
||||||
|
|
||||||
|
def run_simulation(total_pull=200):
|
||||||
|
ten_pull_count = int(total_pull / 10)
|
||||||
|
single_pull_count = ten_pull_count - ten_pull_count
|
||||||
|
no_six_pull_count = 0
|
||||||
|
african_count = 0
|
||||||
|
full_res_list = []
|
||||||
|
for i in range(ten_pull_count):
|
||||||
|
ten_pull_res, no_six_pull_count, is_african = ten_pull(no_six_pull_count)
|
||||||
|
full_res_list += copy.deepcopy(ten_pull_res)
|
||||||
|
if is_african:
|
||||||
|
african_count += 1
|
||||||
|
|
||||||
|
for i in range(single_pull_count):
|
||||||
|
single_res, no_six_pull_count = single_pull(no_six_pull_count)
|
||||||
|
six_star_list = [i for i in full_res_list if i == 6]
|
||||||
|
|
||||||
|
# pull_result = {'Result': full_res_list, 'african': african_count, 'six star count': len(six_star_list)}
|
||||||
|
pull_result = {'african': african_count, 'six star count': len(six_star_list)}
|
||||||
|
return pull_result
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
|
||||||
|
hit = 0
|
||||||
|
hit1 = 0
|
||||||
|
hit2 = 0
|
||||||
|
|
||||||
|
total_pull_count = 180
|
||||||
|
african_threshold = 10
|
||||||
|
six_threshold = 4
|
||||||
|
simulation_count = 50000
|
||||||
|
|
||||||
|
status_dict = {}
|
||||||
|
|
||||||
|
for i in range(simulation_count):
|
||||||
|
k = run_simulation(total_pull_count)
|
||||||
|
key = f"{k['african']}-{k['six star count']}"
|
||||||
|
if key in status_dict:
|
||||||
|
status_dict[key][0] += 1
|
||||||
|
else:
|
||||||
|
status_dict[key] = [0, k['african'], k['six star count']]
|
||||||
|
if k['african'] >= african_threshold and k['six star count'] <= six_threshold:
|
||||||
|
hit += 1
|
||||||
|
if k['african'] == african_threshold and k['six star count'] == six_threshold:
|
||||||
|
hit1 += 1
|
||||||
|
if k['african'] >= african_threshold:
|
||||||
|
hit2 += 1
|
||||||
|
print(hit / simulation_count * 1000, hit1 / simulation_count * 1000, hit2 / simulation_count * 1000)
|
||||||
|
|
||||||
|
fig = plt.figure()
|
||||||
|
ax = fig.add_subplot(111, projection='3d')
|
||||||
|
max_color = max([item[0] for item in status_dict.values()])
|
||||||
|
for key, item in status_dict.items():
|
||||||
|
color = np.array([1, 1 - item[0] / max_color, 0]) # 颜色 其中每个元素在0~1之间
|
||||||
|
ax.bar3d(item[1], item[2], 0, 1, 1, item[0], color=color)
|
||||||
|
ax.text(x=item[1], y=item[2], z=item[0] + 30, s=f"{item[1]}, {item[2]}, {item[0]}",
|
||||||
|
ha='center', fontsize=8, family='Calibri', va='center')
|
||||||
|
ax.set_xlabel('African ten pull')
|
||||||
|
ax.set_ylabel('Six star count')
|
||||||
|
ax.set_zlabel('Count')
|
||||||
|
ax.set_title('Pull Simulation Result')
|
||||||
|
plt.show()
|
||||||
|
|
||||||
|
print('done')
|
||||||
|
|
||||||
Reference in New Issue
Block a user