コード例 #1
0
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()
コード例 #2
0
def report():
  wpatterndict = Dict2(); desc_stair_dict = Dict2()
  reader = ConcursosHistoryPickledStorage(read_as_id=RCH.READ_CONCHIST_AS_TIMEONWARDS_ORDERED_INTS)
  jogos_as_dezenas = reader.get_games_up_to()
  start_index = start_nDoConc - 1
  patternDistance = PatternDistanceAnalyzer()
  for i, jogo_as_dezenas in enumerate(jogos_as_dezenas[start_index:]):
    passing_nDoConc = start_nDoConc + i
    the_one_just_before = passing_nDoConc - 1
    tilr     = TilR.get_tilr_from_pool(n_slots=5, history_nDoConc_range = (1, the_one_just_before)) 
    wpattern = tilr.get_game_tilrpattern_as_str(jogo_as_dezenas)
    #print wpattern, 'concurso', passing_nDoConc, jogo_as_dezenas
    desc_stair_str = tilr.get_game_tilrpattern_as_desc_stair(jogo_as_dezenas) 
    print str(passing_nDoConc).zfill(4), wpattern, desc_stair_str
    wpatterndict.add1_or_set1_to_key(wpattern)
    patternDistance.add_pattern(wpattern)
    desc_stair_dict.add1_or_set1_to_key(desc_stair_str)
  for wpattern in wpatterndict.keys():
    print wpattern, ':', wpatterndict[wpattern]
  for wpattern in desc_stair_dict.keys():
    print wpattern, ':', desc_stair_dict[wpattern]
  patternDistance.mount_distances_histogram()
  patternDistance.summarize()