def analyze(): patternDistance = PatternDistanceAnalyzer() START_AT_N_CONC = 5 slider = ConcursoExt() last_concurso = slider.get_last_concurso() repeats_dict = Dict2() for nDoConc in range(START_AT_N_CONC, last_concurso.nDoConc+1): concurso = slider.get_concurso_by_nDoConc(nDoConc) contrajogos_as_dezenas_list = last_concurso.get_contrajogos_as_dezenas_list_down_to_depth(depth=4, inclusive=True) if contrajogos_as_dezenas_list == None: continue #print concurso.nDoConc, concurso.date, concurso.get_dezenas(), contrajogos_as_dezenas_list repeats_array = jogos_functions.get_array_n_repeats_with_m_previous_games(concurso.get_dezenas(), contrajogos_as_dezenas_list) token = ''.join(map(str, repeats_array)) patternDistance.add_pattern(token) repeats_dict.add1_or_set1_to_key(token) tokens_and_quants = repeats_dict.items() tokens_and_quants.sort(key = lambda x : x[1]) tokens_and_quants.reverse() for token_and_quant in tokens_and_quants: token = token_and_quant[0] quant = token_and_quant[1] pattern = rightFillToNSpaces(token, 3) zquant = leftFillToNSpaces(str(quant), 3) print pattern, ':', zquant patternDistance.mount_distances_histogram() patternDistance.summarize() analyze()
def generator_with_a_bet(): ''' The 4 most occurring repeats_array (processed on 2013-01-06) repeats_array : occurrence (from nDoConc=5 to 1556) 2 : 363 1 : 300 3 : 218 21 : 132 ''' compare_repeat_lists = [[4], [3,1]] gerador = Gerador() slider = ConcursoExt() last_concurso = slider.get_last_concurso() contrajogos = last_concurso.get_contrajogos_as_dezenas_list_down_to_depth(depth=4, inclusive=True) n_passed = 0; counter = 0; n_passed_for_each_compare_repeat_list = {0:0, 1:0} for jogo_as_dezenas in gerador: counter += 1 # if counter > 100: # break for compare_repeat_list in compare_repeat_lists: passed = filter_functions.filter_in_those_within_n_repeats_with_m_previous_games(jogo_as_dezenas, contrajogos, compare_repeat_list) if passed: n_passed += 1 n_passed_for_each_compare_repeat_list[compare_repeat_lists.index(compare_repeat_list)]+=1 print n_passed, counter, 'Passed repeats_array', compare_repeat_list, str(jogo_as_dezenas) #, contrajogos, compare_repeat_list break print n_passed, counter, n_passed_for_each_compare_repeat_list
def adhoc_test(): slider = ConcursoExt() # last_nDoConc = find_last_nDoConc() # backtrack_amount = 400 # down_to_nDoConc = last_nDoConc - backtrack_amount # for nDoConc in range(last_nDoConc, down_to_nDoConc - 1, -1): concurso = slider.get_last_concurso() analyzer = Analyzer(concurso) analyzer.run() analyzer.report()
def adhoc_test3(): slider = ConcursoExt() last_concurso = slider.get_last_concurso() concursotil = ConcursoTil(last_concurso) print 'concursotil', concursotil, 'wpatt', concursotil.wpattern # tilproducer = TilProducer(5, 6) tilfreqslotter = TilFreqSlotSeparator(5) # print tilproducer.alltilwpatterns # patterns_as_intlist = tilproducer.get_alltilpatterns_as_intlist() # tilsets = tilfreqslotter.getTilSets() n_dozens_per_tilslot = tilfreqslotter.get_quantities_of_dozens_per_tilslot() print 'dezenas per tilslot:', n_dozens_per_tilslot # tilhistogram = tilfreqslotter.get_tilhistogram() #print 'tilhistogram:', tilhistogram # filtered_patterns_as_intlist, patterns_filtered_out = filter_out(patterns_as_intlist, tilhistogram) # print 'filtered_patterns_as_intlist', filtered_patterns_as_intlist, len(filtered_patterns_as_intlist) # print 'filtered out patterns', patterns_filtered_out, len(patterns_filtered_out) tilfreqslotter.show_slot_elements() print tilfreqslotter.show_tilhistogram_table()
def report(): slider = ConcursoExt() concurso = slider.get_last_concurso() aggregated_histogram = {} N_SORTEADAS = len(concurso.get_dezenas()) N_SORTEADAS_MAIS_NENHUMA_COINCIDENCIA = N_SORTEADAS + 1 for i in range(N_SORTEADAS_MAIS_NENHUMA_COINCIDENCIA): aggregated_histogram[i] = [] for i in range(10): print i, concurso.nDoConc, concurso.get_dezenas() coincides_histogram = jogos_fd.get_coincides_histogram_against_a_lookup_depth(concurso.get_dezenas(), up_to_nDoConc=concurso.nDoConc-1, LOOKUP_DEPTH=1000) if coincides_histogram == None: continue print coincides_histogram the_n_coincides = coincides_histogram.values() print the_n_coincides, sum(the_n_coincides) for i, coincide_quantity in enumerate(the_n_coincides): aggregated_histogram[i].append(coincide_quantity) concurso = concurso.get_previous() analyzer = AnalyzerOfCoincides(aggregated_histogram) analyzer.analyze()
def get_tilrwpattern_of_game(dezenas, n_slots=5, up_to_concurso=None): slider = ConcursoExt() if up_to_concurso == None: up_to_concurso = slider.get_last_concurso() tilr_obj = TilR(n_slots, up_to_concurso) #, inclusive=False, concurso_range = None) return tilr_obj.get_tilrwpattern_of_game(dezenas)