-
Notifications
You must be signed in to change notification settings - Fork 0
/
WorkoutPlanner.py
100 lines (78 loc) · 2.44 KB
/
WorkoutPlanner.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
# -*- coding: utf-8 -*-
"""
Created on Sat Dec 1 10:52:54 2018
@author: trist
"""
import random
#using lists
#lists of exercises
# [exercise],[[var1],[var2]]
chest = []
back = []
shoulders = []
def addExercise(groupAE,exerciseAE,variationsAE):
groupAE.append([exerciseAE,variationsAE,-1])
addExercise(back,'rows',['bent-over rows','one-arm rows'])
addExercise(back,'pullups',['narrow grip pullups','wide grip pullups'])
addExercise(back,'chinups',None)
addExercise(back,'chest-supported rows',None)
addExercise(back,'shrugs',None)
#given muscle group, point to a list of exercises
#randomly choose n exercises (or variations)
random.seed()
def checkIfUsed(groupCIU,indexCIU,countCIU):
if groupCIU[indexCIU][2] == -1:
return indexCIU
elif countCIU > 10:
print('---no available workouts')
return -1
else:
indexCIU += 1
indexCIU = indexCIU%len(groupCIU)
indexCIU = checkIfUsed(groupCIU,indexCIU,countCIU+1)
return indexCIU
def randomExercise(groupRE):
#random exercise
index = random.randint(0,len(groupRE)-1)
#check if exercise is already used
index = checkIfUsed(groupRE,index,0)
if index == -1: #error check
return 0
#assign exercise
exercise = groupRE[index]
groupRE[index][2] = 0
#assign variation (if applicable)
if exercise[1] != None:
index = random.randint(0,len(exercise[1])-1)
exercise = exercise[1][index]
else:
exercise = exercise[0]
return exercise
<<<<<<< HEAD
def randomExercise():
index = random.randint(0,len(back)-1)
print(f'precheck:{back[index]}')
index = checkIfUsed(back,index,0)
print(f'postcheck:{back[index]}')
exercise = back[index]
back[2] = -1
if exercise[1] != None:
index = random.randint(0,len(exercise[1])-1)
exercise = exercise[1][index]
print(f'variation:{back[index]}')
for i in range(5):
randomExercise()
=======
for i in range(6):
exercise = randomExercise(back)
if exercise == 0:
break
print(exercise)
>>>>>>> ab254e78f5a70038d2c753d0e7bc0110dec74d01
#print(f'exercise: {back[index]}')
#make sure the same exercise doesn't get chosen twice (factor in list, reset)
#check which exercises have been done by user in the past, show previous stats
#return list of exercises (with characteristics) and allow user input
# reps|sets|weight|up/hold/down|notes
#option to regenerate a single exercise
#"all exercises checked" and reset factor