예제 #1
0
파일: Del09.py 프로젝트: lcharlesb/cs228
            if (timeAllowedPerNumber == 40):
                timeAllowedPerNumber = 35
            if (timeAllowedPerNumber == 35):
                timeAllowedPerNumber = 30
            if (timeAllowedPerNumber == 30):
                timeAllowedPerNumber = 25
            numSuccesses = 0
        if (numCounter >= timeAllowedPerNumber):
            numCounter = 0
            programState = 4
        if (currentNumCorrect == 1):
            numCounter = 0
            numToSign = randint(1, numbersToDisplay)
            currentNumCorrect = 0
            countForNumCorrect = 0
            userEntry = database[userName]
            numToIncrement = userEntry['digit' + str(numToSign) + 'attempted']
            numToIncrement += 1
            userEntry['digit' + str(numToSign) + 'attempted'] = numToIncrement
        HandleState2(frame, numToSign)
        pickle.dump(database, open('userData/database.p', 'wb'))
        pygameWindow.DrawDatabaseData(database, userName)
        numCounter += 1
    elif programState == 3:
        HandleState3(frame)
        pygameWindow.DrawDatabaseData(database, userName)
    elif programState == 4:
        HandleState4(frame)
        pygameWindow.DrawDatabaseData(database, userName)
    pygameWindow.Reveal()
예제 #2
0
pygameWindow = PYGAME_WINDOW()

while True:

    pygameWindow.Prepare()
    frame = controller.frame()
    k = 0

    if(len(frame.hands) < 1):
        programState = 0

    if programState == 0:
        HandleState0(frame)
    elif programState == 1:
        HandleState1(frame)
    elif programState == 2:
        HandleState2(frame)
        pygameWindow.DrawDatabaseData(database, userName, countSuccesses, countAttempts, previousPercentage, currUserRank)
    elif programState == 3:
        HandleState3(frame)
        pygameWindow.DrawDatabaseData(database, userName, countSuccesses, countAttempts, previousPercentage, currUserRank)
    elif programState == 4:
        HandleState4(frame)
        pygameWindow.DrawDatabaseData(database, userName, countSuccesses, countAttempts, previousPercentage, currUserRank)
    elif programState == 5:
        HandleState5(frame)
        pygameWindow.DrawDatabaseData(database, userName, countSuccesses, countAttempts, previousPercentage, currUserRank)

    pygameWindow.Reveal()