Beispiel #1
0
def chainLevel1to2(nOfNextConc=Sena.getNOfLastJogo()+1):
  filePath = '../Apostas/CombinationsChain-level-1-%s.txt' %(nOfNextConc)
  inFile = open(filePath)
  filePathOutput = '../Apostas/CombinationsChain-level-2-%s.txt' %(nOfNextConc)
  outFile = open(filePathOutput, 'w')
  line = inFile.readline(); c = 0
  while line:
    dezenas = dezenasIntFromTextLine(line)
    if dezenas == None:
      line = inFile.readline()
      continue
    c += 1
    jogo = Sena.Jogo(-c)
    jogo.setDezenas(dezenas)
    tuple2 = filters.passThruFilters(jogo)
    hasPassed = tuple2[0]
    if not hasPassed:
      msgCode = tuple2[1]
      print jogo, filters.getMessageStrFromFilterReturnNumberCode(msgCode)
    else:
      dezenasStrList = map(tmpF, dezenas)
      dezenasStr = ' '.join(dezenasStrList)
      outLine = '%s' %(dezenasStr)
      outFile.write(outLine + '\n')
    line = inFile.readline()
  outFile.close()
def almostManualJogo(freqOrderSets):
  if len(freqOrderSets) != 6:
    raise ValueError
  combs = []; d = [None] * 6
  for d[0] in freqOrderSets[0]:
    for d[1] in freqOrderSets[1]:
      for d[2] in freqOrderSets[2]:
        for d[3] in freqOrderSets[3]:
          for d[4] in freqOrderSets[4]:
	    for d[5] in freqOrderSets[5]:
              dezenas = d[:] # hard copy
	      dezenas.sort()
	      combs.append(dezenas)
  combs.sort(); c = 0
  nextConc = Sena.getNOfLastJogo() + 1
  apostasFilename = '../Apostas/apostasAlmostManual-%04d.txt' %(nextConc)
  print 'Begin writing', apostasFilename, 'with', len(combs), 'jogos.'
  apostasFile = open(apostasFilename, 'w')
  for dezenas in combs:
    c += 1
    jogo = Sena.Jogo(-c)
    jogo.setDezenas(dezenas)
    #print 'filter', jogo,
    respBool, code = filters.passThruFilters(jogo)
    if not respBool:
      pass
      #print respBool, filters.getMessageStrFromFilterReturnNumberCode(code)
    else:
      dezenasList = map(tmpF, dezenas)
      line = ' '.join(dezenasList)
      print line
      apostasFile.write(line + '\n')
  print 'Closing', apostasFilename, 'with', len(combs), 'jogos.'
  apostasFile.close()
Beispiel #3
0
def checkApostasFileThruFilters():
  nOfLastJogo = Sena.getNOfLastJogo()
  filePath = '../Apostas/apostas-%04d.txt' %(nOfLastJogo)
  fileIn = open(filePath)
  line = fileIn.readline(); c=0; falsesDict = {}; nOfOks = 0
  while line:
    dezenas = volantePrintingFunctions.transformLineToDezenasList(line)
    if dezenas != None:
      c+=1
      jogo = Sena.Jogo(-c)
      jogo.setDezenas(dezenas)
      resp, cod = filters.passThruFilters(jogo)
      dezenasStrList = map(tmpF, dezenas)
      dezenasStr = ' '.join(dezenasStrList)
      print dezenasStr,
      if not resp:
        print 'fail pass', cod, filters.getMessageStrFromFilterReturnNumberCode(cod)
      else:
        nOfOks += 1
      print 'ok'
      if not resp:
        try:
          falsesDict[cod] += 1
        except KeyError:
          falsesDict[cod] = 1
  line = fileIn.readline()
  cods = falsesDict.keys()
  cods.sort()
  print '='*40
  print 'Histogram for falses from filters:'
  print '='*40
  for cod in cods:
    print '%2dx %d:%s' %(falsesDict[cod],cod, filters.getMessageStrFromFilterReturnNumberCode(cod))
  print '-'*40
  percentOfOks = nOfOks * 100 / (0.0 + c)
  print 'Total', c, ':: ok/total = %5.2f' %(percentOfOks), '%'