Пример #1
0
def InsertNewGame():
        print("============ CADASTRAR JOGO =============")
        

        # Collecting data
        print("> Concurso:", end=" ")
        gameId = input()

        print("> Data:", end=" ")
        date = input()
                
        print("> Bola 1:", end=" ")
        b1 = input()

        print("> Bola 2:", end=" ")
        b2 = input()

        print("> Bola 3:", end=" ")
        b3 = input()

        print("> Bola 4:", end=" ")
        b4 = input()

        print("> Bola 5:", end=" ")
        b5 = input()

        print("> Bola 6:", end=" ")
        b6 = input()

        with open('../assets/mega.csv','a') as csvFile:
            csvFile.write("\n" + gameId + "," + date + "," + b1 + "," + b2 + "," + b3 + "," + b4 + "," + b5 + "," + b6)

        print("\n\n> CADASTRO FEITO COM SUCESSO!! ")

        ui.Continue()
Пример #2
0
def NumberRecurrence():

    print("|> Qual número deseja analisar ?")
    print("|> Número:", end=" ")

    baseNumber = int(input())
    games = []
    recurrence = np.zeros((25,), dtype=int)

    # Console
    os.system(ui.Clear())
    print("========== RELAÇÃO NÚMERICA (BOLA "+ str(baseNumber) +") ===========\n")
    print("- Lendo arquivo ... ")

    # Read de file and store all games
    with open('../assets/lotofacil.csv', mode='r') as csvFile:

        csvReader = csv.DictReader(csvFile)
        lineCount = 0

        for row in csvReader:

            if lineCount == 0:
                lineCount += 1

            tempGame = LotoFacil(row["id"], row["date"], row["n1"], row["n2"], row["n3"], row["n4"], row["n5"], row["n6"], row["n7"], row["n8"], row["n9"], row["n10"], row["n11"], row["n12"], row["n13"], row["n14"], row["n15"])

            games.append(tempGame)
            lineCount += 1
    
    print("- Analisando dados ...")
    baseNumberCount = 0

    # Count every game to analyse number recurrence
    for game in games:
        for num in game.numbers:
            number = int(num)
            # This game have ne choosed number
            if(number == baseNumber):
                baseNumberCount += 1
                # Update de recurrence array
                for num in game.numbers:
                    number = int(num)
                    if(number != baseNumber):
                        recurrence[number-1] += 1

    print("- Ordenando resultado ...\n")

    topBalls = recurrence.argsort()[-5:][::-1]

    for i, ball in enumerate(topBalls):
        print("|> " + ui.PrintNumber(str(i+1))+"º:\t[Bola (" + ui.PrintNumber(str(ball+1)) + ")]\tem " + str(recurrence[ball]) + " jogos\t ("+ RecurrencePercentage(baseNumberCount, recurrence[ball]) + ")")

    print("\n")
    ui.Continue()
Пример #3
0
def RandomNumber():

    n = random.randint(1,60)

    print("============== NÚMERO SORTEADO ==============\n")
    if n < 10:
        print("> Número sorteado: 0", end=str(n)+"\n\n")

    else:
        print("> Número sorteado: ", end=str(n)+"\n\n")

    ui.Continue()
Пример #4
0
def RandomGame():

    sortNumbers = []

    for i in range(6):
        n = random.randint(1,60)
        if n not in sortNumbers:
            sortNumbers.append(n)

    print("============== JOGO SORTEADO ==============\n")
    print("> Jogo sorteado: ", end=" ")
    print(sortNumbers, end="\n\n")
    ui.Continue()
Пример #5
0
def RandomGame():

    sortNumbers = []

    while len(sortNumbers) < 15:
        n = random.randint(1,25)
        if n not in sortNumbers:
            sortNumbers.append(n)

    print("============== JOGO SORTEADO ==============\n")

    for i in range(len(sortNumbers)):
        print("("+ui.PrintNumber(str(sortNumbers[i]))+")", end=" ")
        if((i+1) % 5 == 0):
            print("\n")

    print("===========================================\n")

    
    print("\n")
    ui.Continue()
Пример #6
0
def topFive():

    # Console
    print("============ TOP 10 NÚMEROS =============")
    print("- Lendo arquivo ... ")

    games = []
    recurrence = np.zeros((60,), dtype=int)

    # Read de file and store all games
    with open('../assets/lotofacil.csv', mode='r') as csvFile:

        csvReader = csv.DictReader(csvFile)
        lineCount = 0

        for row in csvReader:

            if lineCount == 0:
                lineCount += 1

            tempGame = Game(row["id"], row["date"], row["n1"], row["n2"], row["n3"], row["n4"], row["n5"], row["n6"])
            games.append(tempGame)
            
            lineCount += 1
    
    print("- Analisando dados ...\n")

    for game in games:
        for num in game.numbers:
            number = int(num)
            recurrence[number - 1] += 1

    topBalls = np.argpartition(recurrence, -5)[-5:]

    for i, ball in enumerate(topBalls):
        print("> " + str(i+1)+"º: [Bola " + str(ball+1) + "]\t apareceu em " + str(recurrence[ball]) + " jogos")

    print("\n")

    ui.Continue()
Пример #7
0
def topNumbers():

    # Console
    print("============ TOP 10 NÚMEROS =============")
    print("|> Lendo arquivo ... ")

    games = []
    recurrence = np.zeros((60,), dtype=int)

    # Read de file and store all games
    with open('../assets/lotofacil.csv', mode='r') as csvFile:

        csvReader = csv.DictReader(csvFile)
        lineCount = 0

        for row in csvReader:

            if lineCount == 0:
                lineCount += 1

            tempGame = LotoFacil(row["id"], row["date"], row["n1"], row["n2"], row["n3"], row["n4"], row["n5"], row["n6"], row["n7"], row["n8"], row["n9"], row["n10"], row["n11"], row["n12"], row["n13"], row["n14"], row["n15"])

            games.append(tempGame)
            lineCount += 1
    
    print("|> Analisando dados ...\n")

    for game in games:
        for num in game.numbers:
            number = int(num)
            recurrence[number - 1] += 1

    topBalls = recurrence.argsort()[-10:][::-1]

    for i, ball in enumerate(topBalls):
        print("|> " + ui.PrintNumber(str(i+1))+"º:\t[Bola (" + ui.PrintNumber(str(ball+1)) + ")]\tem " + str(recurrence[ball]) + " jogos\t ("+ RecurrencePercentage(len(games), recurrence[ball]) + ")")

    print("\n")

    ui.Continue()
Пример #8
0
def NumberRecurrence():

    print("Qual número deseja analisar ?")
    print("> Número:", end=" ")

    baseNumber = int(input())
    games = []
    recurrence = np.zeros((60,), dtype=int)

    # Console
    os.system(ui.Clear())
    print("========== REINCIDÊNCIA DE NÚMERO ===========\n")
    print("- Lendo arquivo ... ")

    # Read de file and store all games
    with open('../assets/mega.csv', mode='r') as csvFile:

        csvReader = csv.DictReader(csvFile)
        lineCount = 0

        for row in csvReader:

            if lineCount == 0:
                lineCount += 1

            tempGame = Game(row["id"], row["date"], row["n1"], row["n2"], row["n3"], row["n4"], row["n5"], row["n6"])
            games.append(tempGame)
            
            lineCount += 1
    
    print("- Analisando dados ...")

    # Count every game to analyse number recurrence
    for game in games:
        for num in game.numbers:
            number = int(num)
            # This game have ne choosed number
            if(number == baseNumber):
                # Update de recurrence array
                for num in game.numbers:
                    number = int(num)
                    recurrence[number-1] += 1

    print("- Ordenando resultado ...\n")

    maxValue = recurrence[0]
    lastMaxValue = recurrence[0]
    maxBallNumber = 0
    lastMaxBallNumber = 0

    for i, num in enumerate(recurrence):
        if num > maxValue:
            if(i+1 != baseNumber):
                lastMaxValue = maxValue
                lastMaxBallNumber = maxBallNumber
                maxValue = num
                maxBallNumber = i
    
    print("> 1º : [Bola " + str(maxBallNumber+1) + "] - " + str(maxValue) + " repetições com a Bola " + str(baseNumber))
    print("> 2º : [Bola " + str(lastMaxBallNumber+1) + "] - " + str(lastMaxValue) + " repetições com a Bola " + str(baseNumber))
    print("> Bola " + str(baseNumber) + " apareceu em " + str(recurrence[baseNumber-1]) + " jogos\n\n")

    ui.Continue()
Пример #9
0
def InsertNewGame():
        print("============ CADASTRAR JOGO =============")
        

        # Collecting data
        print("> Concurso:", end=" ")
        gameId = input()

        print("> Data:", end=" ")
        date = input()
                
        print("> Bola 01:", end=" ")
        b1 = input()

        print("> Bola 02:", end=" ")
        b2 = input()

        print("> Bola 03:", end=" ")
        b3 = input()

        print("> Bola 04:", end=" ")
        b4 = input()

        print("> Bola 05:", end=" ")
        b5 = input()

        print("> Bola 06:", end=" ")
        b6 = input()

        print("> Bola 07:", end=" ")
        b7 = input()

        print("> Bola 08:", end=" ")
        b8 = input()

        print("> Bola 09:", end=" ")
        b9 = input()

        print("> Bola 10:", end=" ")
        b10 = input()

        print("> Bola 11:", end=" ")
        b11 = input()

        print("> Bola 12:", end=" ")
        b12 = input()

        print("> Bola 13:", end=" ")
        b13 = input()

        print("> Bola 14:", end=" ")
        b14 = input()

        print("> Bola 15:", end=" ")
        b15 = input()

        with open('../assets/lotofacil.csv','a') as csvFile:
            csvFile.write("\n" + gameId + "," + date + "," + b1 + "," + b2 + "," + b3 + "," + b4 + "," + b5 + "," + b6 + "," + b7 + "," + b8 + "," + b9 + "," + b10 + "," + b11 + "," + b12 + "," + b13 + "," + b14 + "," + b15)

        print("\n\n> CADASTRO FEITO COM SUCESSO!! ")

        ui.Continue()