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

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

Loading…
Cancel
Save