def cal_odd_reds(ball): ''' 计算偶数 :param 输入Foliagessq或者Tssqshishibiao的对象: :return:红球偶数个数 ''' ssq_property=TSsqShishibiao_ext() ssq_property.odd_reds=0 ssq_red=ball.list_red_balls() for i in ssq_red: if (int(i) % 2) == 0: # print i ssq_property.odd_reds+=1 return ssq_property.odd_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