def geraVolantes(): jogosObj=CLClasses.getJogosObj('lf') jogos = [] for i in range(1,5): jogo = jogosObj.getJogos()[-i] jogos.append(jogo) matrix = vpp.Matrix('lf') #matrix.setJogo(jogo) matrix.generateFolha(jogos)
def initJogosObj(jogosObj): if type(jogosObj) == CLClasses.Jogos: return jogosObj if type(jogosObj) == str: standard2LetterName = jogosObj # an error will be raise in CLClasses.getJogosObj() if s2LN is inconsistent jogosObj = CLClasses.getJogosObj(standard2LetterName) return jogosObj # well, if it's neither types above, exception should be raised errorMsg = 'jogosObj is neither a CLClasses.Jogos nor a str %s' %(jogosObj) raise ValueError, errorMsg
def processDBStats(standard2): print 'Instantiating', standard2 print '-'*40 jogosObj = CLClasses.getJogosObj(standard2) statObj = Stat(jogosObj) print 'statObj.moveNDoConcForStatUpdate()', statObj.moveNDoConcForStatUpdate() #statObj.setVarreDe(1) print 'statObj.nOfUpdated', statObj.nOfUpdated print 'statObj.VARRE_DO_JOGO', statObj.VARRE_DO_JOGO statObj.updateAll = True statObj.logIt = True statObj.gatherStats() print 'statObj.updateAll', statObj.updateAll print 'statObj.nOfUpdated', statObj.nOfUpdated
def testProduceOrigDrawnPattern(): jogosObj = CLClasses.getJogosObj('ms') pattKeys = {} for i in range(jogosObj.getNDoUltimoConcurso()): nDoConc = i+1 jogoInOrder = jogosObj.getJogoInOrder(nDoConc) if not jogoInOrder: print '*** not jogoInOrder', nDoConc continue patt = produceOrigDrawnPattern(jogoInOrder, jogosObj.standard2LetterName) try: pattKeys[patt] += 1 except KeyError: pattKeys[patt] = 1 print nDoConc, pprint.jogoListToStr(jogoInOrder), patt, pattKeys[patt]
def testRadii(): tipoJogo = 'ms' #'lf' rad = Radii(tipoJogo) jogosObj = CLClasses.getJogosObj(tipoJogo) nDeCombs = jogosObj.getNDeCombs() lgiComb = jogosObj.getGenericLgiComb() jogos = jogosObj.getJogos() for i in range(4): #lgi = random.randint(0, nDeCombs-1) #jogo = lgiComb.moveTo(lgi) jogo = jogos[i] jogo.sort() # print 'jogo', jogo pathway = rad.calculatePathway(jogo, True) intercrossed = rad.calculateIntercrossed(jogo, True) print jogo, pathway, intercrossed
def testPartialJogos(): ''' testPartialJogos() testJogoObjBinDecRepr() std2letter = 'LF' updateBase(std2letter) jogosObj = getJogosObj(std2letter) jogos = jogosObj.getJogos() pprint.printJogos(jogos) ''' jObj = CLClasses.getJogosObj('LF') print 'jObj.standard2LetterName', jObj.standard2LetterName print jObj.getHistG() partial = PartialJogos('LF') print 'partial.standard2...',partial.standard2LetterName partial.setAteConcurso(100) print partial.getHistG()
def seeTil5inLF(): jogosObj = CLClasses.getJogosObj('lf') til5obj = tilc.Til(jogosObj, 5) lgiObj = lc.LgiCombiner(24, 15) jogo = lgiObj.first(); c=0 print 'Please, wait ::'#, tipoJogo,'nOfCombines =' #, lgiObj.nOfCombines passed = 0 while jogo: #if type(jogo) == CLClasses.Jogo: #jogo = jogo.jogo patt = til5obj.generateLgiForJogoVsTilFaixas(jogo) if int(patt[0]) < 2: if int(patt[1]) < 3: if int(patt[2]) < 8: if int(patt[4]) < 8: passed += 1 c = printOutMultiples(c) jogo = lgiObj.next() print 'passed', passed
def runRunner(): jogosObj = CLClasses.getJogosObj('lf') print 'instantiating Runner' ru = Runner(jogosObj) print 'instantiating Stream' streamObj = Stream.Stream(jogosObj) print 'setStreamInLgiCombiner()' streamObj.setStreamInLgiCombiner() print 'setStreamOutBinFile()' streamObj.setStreamOutBinFile() ru.setStreamObj(streamObj) checkerObj = contr.CheckerSoma3(jogosObj) ru.setCheckerObj(checkerObj) print 'Run Runner ru.run()' ru.run() nowInFilename = ru.outBinFilename print 'setStreamOutBinFile()' streamObj.setStreamInBinFile(nowInFilename) print 'Close Runner ru.close()' ru.close()
def verifyAllCombsWith4OrMoreInAPattern(tilN=10): ''' Eg patterns with 4 or more 0041100000 5000000001 etc ''' print 'instantiating jogosObj ms' jogosObj = CLClasses.getJogosObj('ms') print 'instantiated' til4 = tilc.Til(jogosObj, 4) til5 = tilc.Til(jogosObj, 5) til6 = tilc.Til(jogosObj, 6) til10 = tilc.Til(jogosObj, 10) combObj = ic.IndicesCombiner(59, 6, False) jogo = combObj.firstZeroless() c = 0; booleanTrueCounter = 0; exclCod = 0; count = False while jogo: printAndJump(jogo, c, count, exclCod) c+=1 jogo = combObj.nextZeroless() #print jogo count = False exclCod = 0 patt = til4.generateLgiForJogoVsTilFaixas(jogo) # first digit (least occurring dezenas) cannot be greater than 3 digit = int(patt[0]) exclCod += 1 # 1 if digit > 3: count = True continue # second and last digit cannot be greater than 5 (or, it cannot be 6) digit1 = int(patt[1]) digit3 = int(patt[3]) exclCod += 1 # 2 if digit1 == 6 or digit3 == 6: count = True continue # patt 0060 has occurred 5 times until nDoConc 1113 patt = til5.generateLgiForJogoVsTilFaixas(jogo) # first digit (least occurring dezenas) cannot be greater than 2 digit = int(patt[0]) exclCod += 1 # 3 if digit > 2: count = True continue # last digit (most occurring dezenas) cannot be greater than 5 (though 5 has really happened in history) digit = int(patt[0]) exclCod += 1 # 4 if digit >= 5: count = True continue exclCod += 1 # 5 if '6' in patt: count = True continue patt = til6.generateLgiForJogoVsTilFaixas(jogo) # first digit (least occurring dezenas) cannot be greater than 2 digit = int(patt[0]) exclCod += 1 # 6 if digit > 2: count = True continue # last digit (most occurring dezenas) cannot be greater than 5 (though 5 has really happened in history) digit = int(patt[0]) exclCod += 1 # 7 if '5' in patt: count = True continue exclCod += 1 # 8 if '6' in patt: count = True continue patt = til10.generateLgiForJogoVsTilFaixas(jogo) exclCod += 1 # 9 if '4' in patt: count = True continue exclCod += 1 # 10 if '5' in patt: count = True continue exclCod += 1 # 11 if '6' in patt: count = True continue exclCod = 0
def testStatClassPrintAttributes(): jogosObj = CLClasses.getJogosObj('LF') stat = StatClasses.Stat(jogosObj) stat.printAttributes()
def testLgiInJogoClass(): jogosObj = CLClasses.getJogosObj('LF') jogo = jogosObj.getLastJogo() print 'jogo', jogo jogoObj = CLClasses.Jogo(jogo, 'LF') lgi = jogoObj.getLgi()
def testSumm(): jogosObj = CLClasses.getJogosObj('lf') summary(jogosObj)
#!/usr/bin/env python # -*- coding: utf-8 -*- import Image, sys a=1 sys.path.insert(0,'.') #sys.path.insert(0,'..') import CLClasses import funcsForCoincs as fCoincs import Stream # lf-468-apostas-01.bin filename = 'Apostas/lf-468-apostas-01.bin' sigla = 'lf' jogosObj = CLClasses.getJogosObj(sigla) streamIn = Stream.Stream(jogosObj) streamIn.setStreamInFile(filename) def checkThru(jogo): print 'checkThru(jogo):', jogo jogoComp = streamIn.first(); c=0 while jogoComp: nOfCoincs = fCoincs.getNOfCoincidences c+=1 if nOfCoincs > 11: print c, jogo, nOfCoincs jogo = streamIn.next() def do(): #fileNDoConc = 468 compareToList = range(469, 471)