def cal_lianhao(ball): ''' 计算连号个数 :param 输入Foliagessq或者Tssqshishibiao的对象: :return:红球连号个数 ''' ssq_property=TSsqShishibiao_ext() ssq_property.red_lianhaoshu=0 list=cal_horizontal_span(ball) for i in list: if i==1: ssq_property.red_lianhaoshu+=1 #红球差,后一个减前一个,返回一个list,对应5个水平位移 if ssq_property.red_lianhaoshu>1: ssq_property.red_lianhaoshu+=1 return ssq_property.red_lianhaoshu
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