def testAdHoc4(): tilObj = fm.TilMaker() tilSets = tilObj.getTilSets() print 'tilObj.getTilSets()', tilSets concurso = sl.getConcursoObjByN() print 'concurso', concurso print 'concurso.getTilN()', concurso.getTilN(), concurso.getDezenas()
def testAdHoc6(): tilPatterns = [] for nDoConcurso in range(1000, 1334): concurso = sl.getConcursoObjByN(nDoConcurso) tilPattern = concurso.getTilN() tilPatterns.append(tilPattern) print concurso.getDezenas(), tilPattern print tilPatterns
def getDozensLastOccurrencePerConcurso(self, nDoConc=None): nTotalDeConcursos = sl.getNTotalDeConcursos() if nDoConc == None: nDoConc = nTotalDeConcursos if nDoConc < 1 or nDoConc > nTotalDeConcursos: return None concurso = sl.getConcursoObjByN(nDoConc) dezenas = concurso.getDezenas(); lastDepthPerDozenDict = {} for dezena in dezenas: lastDepthPerDozenDict[dezena] = lookUpDozenLastOccurDepth(dezena, nDoConc) return lastDepthPerDozenDict
def lookUpDozenLastOccurDepth(dezena, nDoConcWhereDezenaIs): ''' this method may be considered 'static' ''' for nDoConc in range(nDoConcWhereDezenaIs - 1, 0, -1): concObj = sl.getConcursoObjByN(nDoConc) dezenas = concObj.getDezenas() if dezena in dezenas: depth = nDoConcWhereDezenaIs - nDoConc return depth return None
def lookUpDozenLastOccurrenceNDoConc(dezena): ''' this method may be considered 'static' it considers the last concurso and call lookUpDozenDepth(dezena, nDoConcWhereDezenaIs) However, one care is taken: if dezena happened in the last concurso. 0 (zero) should be returned ''' concurso = sl.getConcursoObjByN() # this picks up the last concurso if concurso.isDezenaInConcurso(dezena): # if true, depth is 0, ie, dezena happened at the last concurso return 0 nTotalDeConcursos = sl.getNTotalDeConcursos() # the same thing: = concurso['nDoConcurso'] return lookUpDozenLastOccurDepth(dezena, nTotalDeConcursos)
def stats_lastDepthPerDozenForAllConcursos(self, printCallBack=None): if self.dozensLastOccurrenceForAllConcursos == None: self.generateDozensLastOccurrenceForAllConcursos() nTotalDeConcursos = sl.getNTotalDeConcursos() self.minDepth = 100; self.maxDepth = 0; depthHistogram = {} # sweep all concursos for nDoConc in range(1, nTotalDeConcursos+1): lastDepthPerDozenDict = self.dozensLastOccurrenceForAllConcursos[nDoConc - 1] tilIndices = self.processDezenasFor_stats_lastDepthPerDozenForAllConcursos(lastDepthPerDozenDict, depthHistogram) tilStats = fForFreqs.Stats1(tilIndices) #params = nDoConc, tilIndices, tilStats #.getHistogram() concurso = sl.getConcursoObjByN(nDoConc) print nDoConc, concurso.getDezenasPrintable(), tilStats #.getHistogram()tilIndices, print 'minDepth', self.minDepth, 'maxDepth', self.maxDepth '''
def produceDozensDepthRow(dezena): ''' each dezena has an array that corresponds to the number of concursos it last occurred from occurrence to occurrence Ex. depthRow of dozen 15 = [3, 5, 1, ..., 12] This means, starting backwards, from its last occurrence, it occurred 3 concursos before the last, than 5 from the one before last and so on ''' allDezenasDepthRow = [] # nTotalDeConcursos = sl.getNTotalDeConcursos() lastOccurrence = lookUpDozenLastOccurrenceNDoConc(dezena); currentDepth = 0 for nDoConc in range(lastOccurrence - 1, 0, -1): currentDepth += 1 concurso = sl.getConcursoObjByN(nDoConc) dezenas = concurso.getDezenas() if dezena in dezenas: allDezenasDepthRow.append(currentDepth) currentDepth = 0 return allDezenasDepthRow