优化红球的打印和变量名,逻辑相对更清晰

main
roger 2 years ago
parent cf275d0175
commit 5763774e89
  1. 27
      red_forecast.py

@ -98,15 +98,19 @@ def get_red_forecast(_all_data, _red_data_dict, _red_data, range_num=1):
else: else:
_red_forecast_dict[_r] = _sum _red_forecast_dict[_r] = _sum
_red_forecast_dict = dict_rate(dict_sort(_red_forecast_dict, 'val', True)) _red_forecast_dict = dict_rate(dict_sort(_red_forecast_dict, 'val', True))
n = 1
for k, v in _red_forecast_dict.items(): for k, v in _red_forecast_dict.items():
if n == 12 or n == 23:
print('-' * 10)
print(f"{k}-{v}") print(f"{k}-{v}")
n += 1
_red_forecast_list = [] _red_forecast_list = []
for _red, __ in _red_forecast_dict.items(): for _red, __ in _red_forecast_dict.items():
_red_forecast_list.append(_red) _red_forecast_list.append(_red)
print('高概率红球推荐:') # print('高概率红球推荐:')
print(', '.join(sorted(_red_forecast_list[0:6]))) # print(', '.join(sorted(_red_forecast_list[0:6])))
# 产生随机数 # 产生随机数
red_index_list = get_random_index() red_index_list = get_random_index()
@ -154,16 +158,16 @@ def update_red_forecast_db():
def get_random_index(): def get_random_index():
# 产生随机数 # 产生随机数
random_small, random_middle, random_big = -1, -1, -1 random_high, random_middle, random_low = -1, -1, -1
while random_small < 0 or random_middle < 0 or random_big < 0: while random_high < 0 or random_middle < 0 or random_low < 0:
random_small = random.randint(0, 2) random_high = random.randint(0, 2)
random_big = random.randint(1, 6 - random_small) random_low = random.randint(1, 6 - random_high)
random_middle = 6 - random_small - random_big random_middle = 6 - random_high - random_low
# print(random_small, random_middle, random_big) print('分布区间(高概率区,中概率区,低概率区):', random_high, random_middle, random_low)
small_red_index_list = [n[0] - 1 for n in new_num(11, random_small)[0:random_small]] high_red_index_list = [n[0] - 1 for n in new_num(11, random_high)[0:random_high]]
middle_red_index_list = [n[0] - 1 + 10 for n in new_num(11, random_middle)[0:random_middle]] middle_red_index_list = [n[0] - 1 + 10 for n in new_num(11, random_middle)[0:random_middle]]
big_red_index_list = [n[0] - 1 + 20 for n in new_num(11, random_big)[0:random_big]] low_red_index_list = [n[0] - 1 + 20 for n in new_num(11, random_low)[0:random_low]]
red_index_list = sorted(small_red_index_list + middle_red_index_list + big_red_index_list) red_index_list = sorted(high_red_index_list + middle_red_index_list + low_red_index_list)
# print(red_index_list) # print(red_index_list)
return red_index_list return red_index_list
@ -172,3 +176,4 @@ if __name__ == "__main__":
# 实现获取含有这个数的下一期或几期中数字的概率 # 实现获取含有这个数的下一期或几期中数字的概率
# 实现获取含有所以数据的总出现概率 # 实现获取含有所以数据的总出现概率
update_red_forecast_db() update_red_forecast_db()
# print(get_random_index())

Loading…
Cancel
Save