您当前所在位置:
首页 方法技巧 DeepseeK 排列三源码

DeepseeK 排列三源码

猫王888 372 2025-04-28 10:14

import itertools



# 需要用户提供真实的历史数据(替换示例数据)

history = [

'444','523','195','216','404',

'347','701','143','841','831','324','801','395','436','812',

'274','681','088','623','134','886','859','465','905','285',

'034','347','156','945','810','006','004','340','030','044',

'701','552','898','037','680','581','933','877','398','201',

'425','841','508','582','843','483','718','533','413','471',

'080','071','332','355','243','793','863','050','678','914',

'630','023','257','134','125','147','811','712','679','848',

'746','499','249','172','155','918','031','653','084','481',

'546','620','677','893','192','907','220','788','691','123',

'900','168','351','617','656','362','128','806','143','027',

'471','978','508','398','963','956','292','734','159','346',

'484','788','228','677','346','048','822','489','297','513',

'392','934','309','849','521','578','366','588','875','916',

'675','552','805','702','372','806','570','037','570','973',

'337','899','384','916','716','765','672','771','793','490',

'257','466','656','990','184','671','975','934','771','462',

'935','132','179','743','407','425','113','296','738','766',

'344','593','304','353','634','845','222','208','993','830',

'721','432','534','672','948','171','192','174','997','911',

'233','471','144','084','076','726',



]  # 确保包含200期数据



# 初始化三维转移矩阵

transfer = [[[0]*10 for _ in range(10)] for _ in range(3)]



# 构建转移概率矩阵

for i in range(len(history)-1):

    current = history[i]

    next_num = history[i+1]

   

    for pos in range(3):

        current_digit = int(current[pos])

        next_digit = int(next_num[pos])

        transfer[pos][current_digit][next_digit] += 1



def get_top_digits(pos, last_digit):

    """获取指定位置推荐数字"""

    frequency = transfer[pos][last_digit]

    sorted_digits = sorted(enumerate(frequency), key=lambda x: (-x[1], -x[0]))

   

    # 选择前四个有效数字

    candidates = [d for d, cnt in sorted_digits if cnt > 0][:6]

   

    # 不足时补充全局高频数字

    if len(candidates) < 6:

        global_freq = [sum(transfer[pos][d][n] for n in range(10)) for d in range(10)]

        backup = sorted(enumerate(global_freq), key=lambda x: -x[1])[:6]

        candidates += [d for d, _ in backup if d not in candidates]

   

    return candidates[:6]



# 获取最新一期开奖号码(示例)

last_number = history[-1]

print(f"最新一期开奖号码:{last_number}")



# 生成推荐数字

positions = [

    (0, int(last_number[0])),  # 百位

    (1, int(last_number[1])),  # 十位

    (2, int(last_number[2]))   # 个位

]



recommend = []

for pos, digit in positions:

    recommend.append(get_top_digits(pos, digit))



# 生成所有组合

combinations = list(itertools.product(*recommend))



# 打印结果

print("\n推荐投注组合(216注):")

for i, combo in enumerate(combinations):

    print(f"{combo[0]}{combo[1]}{combo[2]}", end=' ')

    if (i+1) % 20 == 0:  # 每行显示16个号码

        print()



# 风险提示

print("\n重要提示:本分析结果仅供参考,彩票具有随机性,请理性投注!")