def cal_zhishu(ball):
    '''
    计算质数
    :param 输入Foliagessq或者Tssqshishibiao的对象:
    :return:红球质数个数
    '''
    ssq_property=TSsqShishibiao_ext()
    ssq_property.prime_reds=0
    zhishu=[2,3,5,7,11,13,17,19,23,29,31]
    ssq_red=ball.list_red_balls()
    for i in ssq_red:
        if i in zhishu:
            ssq_property.prime_reds+=1
    return ssq_property.prime_reds
def cal_shishibiao_ext(tss_ball):
    #事实表根据本次球算出扩展属性,返回shishibiao_ext类型对象
    ball_ext=TSsqShishibiao_ext()
    ball_ext.id=tss_ball.num
    ball_ext.num=tss_ball.num
    ball_ext.red_sum=tss_ball.sum1
    ball_ext.prime_reds=cal_zhishu(tss_ball)#质数
    ball_ext.odd_reds=cal_odd_reds(tss_ball)#偶数
    ball_ext.red_shouweikuadu=cal_all_kuadu(tss_ball)#红球首尾快读
    ball_ext.red_weihe=cal_weihe(tss_ball)#首尾跨度
    ball_ext.red_lianhaoshu=cal_lianhao(tss_ball)#连号数
    ball_ext.vertical_blue=cal_blue_differ(tss_ball)#蓝球跨度
    ball_ext.span_reds(cal_horizontal_span(tss_ball))#红球横向差
    ball_ext.vertical_reds(cal_vertical_red(tss_ball))#红球纵向差

    return ball_ext