예제 #1
0
def exercise(data, progressions):
    '''executes the exercise protocol, that is,
    1. loops over all the progressions checking the current exercise.
    2. for each exercise, gives 3 repetitions
    3. checks if the exercise was seccessful,it upgrades / downgrades for next time
    '''
    print('### STARTING WORKOUT! ###')
    for progression in progressions.keys():
        workon = data[progression]
        print('CURRENT PROGRESSION: ' + progression.upper() + '\n')
        print('* EXERCISE: ' + workon.get_name() + '\n')
        print('* REPETITIONS: ' + str(workon.get_status()) + '\n')
        for i in range(3):
            print('REP: ' + str(i+1))
            input('Press Enter when done!')
            print('Rest: 90 seconds')
            for t in range(9):
                time.sleep(10)
                print((90-(t+1)*10),  'Seconds left')
            winsound.Beep(400, 1000)

        if input('Successful? (Y/N): ') == 'Y':
            workon.power_up()
            if workon.get_status() > [8, 8, 8]:
                exercise_index = progressions[progression].index(workon.get_name())
                workon.next_exercise(progressions[progression][exercise_index+1])
        else:
            workon.power_down()
        data[progression] = workon
        print('#########################')
    return data
예제 #2
0
def init(data):
    '''Creates a new dictionary containing the starting point of the workout
    '''
    for progression in progressions.keys():
        index = select_workout(progression, progressions)
        status = list(input('How many repetitions can you do?: '))
        for i in range(len(status)):
            status[i] = int(status[i])
        data[progression] = workout(progression, progressions[progression][index], status)
        print('\n'*2)
    return data