Esempio n. 1
0
	def get_i6_monthly_winning(self):		
		# return monthly winning for i6
		monthly_winning = []
		for each_month in get_i6_combined():
			this_month_winning = 0
			for each_draw in each_month:
				this_month_winning += prize_calc.i6_prize_calc(each_draw)
			monthly_winning.append(this_month_winning)
		return monthly_winning		
Esempio n. 2
0
	def get_i4_monthly_winning(self):		
		# return monthly winning for i4
		monthly_winning = []
		for each_month in get_i4_combined():
			this_month_winning = 0
			for each_draw in each_month:
				this_month_winning += prize_calc.i4_prize_calc(each_draw)
			monthly_winning.append(this_month_winning)
		return monthly_winning		
		

		i24_total_winning = 0
		for each in i24_monthly_winning:
			i24_total_winning += each
			
		i12_monthly_winning = []
		for each_month in i12:
			this_month_winning = 0
			for each_draw in each_month:
				this_month_winning += prize_calc.i12_prize_calc(each_draw)
			i12_monthly_winning.append(this_month_winning)
		i12_total_winning = 0
		for each in i12_monthly_winning:
			i12_total_winning += each

		i6_monthly_winning = []
		for each_month in i6:
			this_month_winning = 0
			for each_draw in each_month:
				this_month_winning += prize_calc.i6_prize_calc(each_draw)
			i6_monthly_winning.append(this_month_winning)
		i6_total_winning = 0
		for each in i6_monthly_winning:
			i6_total_winning += each
			
		i4_monthly_winning = []
		for each_month in i4:
			this_month_winning = 0
			for each_draw in each_month:
				this_month_winning += prize_calc.i4_prize_calc(each_draw)
			i4_monthly_winning.append(this_month_winning)
		i4_total_winning = 0
		for each in i4_monthly_winning:
			i4_total_winning += each
Esempio n. 3
0
    
i12_monthly_winning = []
for each_month in i12:
    this_month_winning = 0
    for each_draw in each_month:
        this_month_winning += prize_calc.i12_prize_calc(each_draw)
    i12_monthly_winning.append(this_month_winning)
i12_total_winning = 0
for each in i12_monthly_winning:
    i12_total_winning += each

i6_monthly_winning = []
for each_month in i6:
    this_month_winning = 0
    for each_draw in each_month:
        this_month_winning += prize_calc.i6_prize_calc(each_draw)
    i6_monthly_winning.append(this_month_winning)
i6_total_winning = 0
for each in i6_monthly_winning:
    i6_total_winning += each
    
i4_monthly_winning = []
for each_month in i4:
    this_month_winning = 0
    for each_draw in each_month:
        this_month_winning += prize_calc.i4_prize_calc(each_draw)
    i4_monthly_winning.append(this_month_winning)
i4_total_winning = 0
for each in i4_monthly_winning:
    i4_total_winning += each
def analyze_num_bought(num_bought):

        
    ## ========== WEB PARSING STAGE ========== ##
    start = "2015/08/01"
    end = "2015/08/31"
    print "Getting winnings data: " + start + " - " + end

    raw_result = get_data(start, end)

    combined_result = combine(raw_result)

    i24 = num_cat_sort_module.get_i24(combined_result)
    i12 = num_cat_sort_module.get_i12(combined_result)
    i6 = num_cat_sort_module.get_i6(combined_result)
    i4 = num_cat_sort_module.get_i4(combined_result)



    ## ========== CALCULATE THE NUM OF DRAW WITHIN STIPULATED RANGE ==========#

    draw_count = 0
    for each_draw in combined_result:
        draw_count += each_draw[3]

    ## ========== GET WINNING FOR EACH NUM ========== ##

    i24_num_winning = {}
    for each_draw in i24:
        num = each_draw[0]
        amount = prize_calc.i24_prize_calc(each_draw)

        if num in i24_num_winning:
            i24_num_winning[num] += amount
        else:
            i24_num_winning[num] = amount

    i12_num_winning = {}
    for each_draw in i12:
        num = each_draw[0]
        amount = prize_calc.i12_prize_calc(each_draw)

        if num in i12_num_winning:
            i12_num_winning[num] += amount
        else:
            i12_num_winning[num] = amount
    
    i6_num_winning = {}
    for each_draw in i6:
        num = each_draw[0]
        amount = prize_calc.i6_prize_calc(each_draw)

        if num in i6_num_winning:
            i6_num_winning[num] += amount
        else:
            i6_num_winning[num] = amount

    i4_num_winning = {}
    for each_draw in i4:
        num = each_draw[0]
        amount = prize_calc.i4_prize_calc(each_draw)

        if num in i4_num_winning:
            i4_num_winning[num] += amount
        else:
            i4_num_winning[num] = amount

    ## ========== CHECK NUM-WINNING DICT AGAINST GIVEN NUM LIST ========== ##

    num_hit = []    #list of num that hit
    total_winning = 0        # store total winning
    all_num_cat_winning = {24:i24_num_winning,12:i12_num_winning,6:i6_num_winning,4:i4_num_winning}
            #dict mapping each num_cat to its winning
    
    for each_num in num_bought:
        each_num_perm = gen_perm(each_num)    # generate all possible permutations for num bought
        num_cat = check_num_cat(each_num)    
        num_winning = all_num_cat_winning[num_cat]
        for each_perm in each_num_perm:
            str_each_num = str(each_perm)
            if str_each_num in num_winning:
                total_winning += num_winning[str_each_num]
                new = [str_each_num, num_winning[str_each_num]]
                num_hit.append(new)

    sorted_num_hit = sorted(num_hit, key=getKey, reverse=True)

    return_lst = [total_winning, draw_count, sorted_num_hit]

    return return_lst
Esempio n. 5
0
    i12_monthly_num_winning.append(sorted(lst_num_winning, key=getKey, reverse=True))
        # sort the list with highest wing first and append to whole i24 list
for num, win in i12_combined_winning.items():
    new = [num, win]
    i12_combined_num_winning.append(new)

i12_all24m_num_winning = sorted(i12_combined_num_winning, key=getKey, reverse=True)


i6_monthly_num_winning = []
for each_month in i6:
    num_winning = {}
    lst_num_winning = []
    for each_draw in each_month:
        num = each_draw[0]
        amount = prize_calc.i6_prize_calc(each_draw)
        if num in num_winning:
            num_winning[num] += amount
        else:
            num_winning[num] = amount
        # put num and winning into dict to count winning amount
    for num, win in num_winning.items():
        new = [num, win]
        lst_num_winning.append(new)
        # convert dict back to list
    i6_monthly_num_winning.append(sorted(lst_num_winning, key=getKey, reverse=True))


i4_monthly_num_winning = []
for each_month in i4:
    num_winning = {}