Skip to content

Instantly share code, notes, and snippets.

@coyotespike
Last active March 9, 2024 23:02
Show Gist options
  • Save coyotespike/aa3a5e7ef70585833039bc4922049753 to your computer and use it in GitHub Desktop.
Save coyotespike/aa3a5e7ef70585833039bc4922049753 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python3
# Prints only Threes wave:
# python3 juggernaut_calculator.py --threes 92.5
# Prints all waves:
# python3 juggernaut_calculator.py 92.5
import argparse
def calculate_weight(max_weight, percentage):
return max_weight * (percentage / 100)
def format_output(percentage, sets, reps, weight, is_realization=False):
if is_realization and sets == 'AMRAP':
# For 'Realization' phase and 'AMRAP' entries, format differently
return f" {percentage}% {sets}: 1 x _r x {weight:.1f} lbs"
elif percentage == 'AMRAP':
# For non-Realization phases or non-AMRAP entries
return f" {percentage}: {sets} x {reps}r x {weight:.1f} lbs"
else:
# Standard formatting for all other entries
return f" {percentage}%: {sets} x {reps}r x {weight:.1f} lbs"
def calculate_phases(max_weight, selected_wave=None):
phases = {
'Accumulation': {
'Tens': [(60, 4, 10), ('AMRAP', 1, '_')],
'Eights': [(65, 4, 8), ('AMRAP', 1, '_')],
'Fives': [(70, 4, 5), ('AMRAP', 1, '_')],
'Threes': [(75, 6, 3), ('AMRAP', 1, '_')],
},
'Intensification': {
'Tens': [(55, 1, 5), (62.5, 1, 5), (67.5, 2, 10), ('AMRAP', 1, '_')],
'Eights': [(60, 1, 3), (67.5, 1, 3), (72.5, 2, 8), ('AMRAP', 1, '_')],
'Fives': [(65, 1, 5), (72.5, 1, 5), (77.5, 3, 5), ('AMRAP', 1, '_')],
'Threes': [(70, 1, 1), (77.5, 1, 1), (82.5, 4, 3), ('AMRAP', 1, '_')],
},
'Realization': {
'Tens': [(50, 1, 5), (60, 1, 3), (70, 1, 1), (75, 'AMRAP', 1)],
'Eights': [(50, 1, 5), (60, 1, 3), (70, 1, 2), (75, 1, 1), (80, 'AMRAP', 1)],
'Fives': [(50, 1, 5), (60, 1, 3), (70, 1, 2), (75, 1, 1), (80, 1, 1), (85, 'AMRAP', 1)],
'Threes': [(50, 1, 5), (60, 1, 3), (70, 1, 2), (75, 1, 1), (80, 1, 1), (85, 1, 1), (90, 'AMRAP', 1)],
},
'Deload': [(40, 1, 5), (50, 1, 5), (60, 1, 5)],
}
for phase, workouts in phases.items():
print(f"\n{phase}:")
if phase == 'Deload':
for detail in workouts:
percentage, sets, reps = detail
weight = calculate_weight(max_weight, percentage)
print(format_output(str(percentage), sets, reps, weight))
else:
for workout, details in workouts.items():
if selected_wave and workout != selected_wave:
continue
print(f" {workout}:")
last_percentage = None
for detail in details:
if detail[0] == 'AMRAP':
percentage = 'AMRAP' # Explicitly use 'AMRAP' for clarity
weight = calculate_weight(max_weight, float(last_percentage))
else:
percentage = detail[0]
weight = calculate_weight(max_weight, float(percentage))
last_percentage = percentage # Update last valid percentage for use in 'AMRAP'
sets, reps = detail[1], detail[2]
# Determine if we are in the Realization phase
is_realization = phase == 'Realization'
print(format_output(percentage, sets, reps, weight, is_realization))
def process_multiple_weights(weights, selected_wave):
for weight in weights:
calculate_phases(weight, selected_wave)
print("\n" + "-"*60) # Separator for readability
def main():
parser = argparse.ArgumentParser(description="Calculate weights for the Juggernaut method lifting program for multiple max weights.")
parser.add_argument("max_weights", type=float, nargs='+', help="One or more max working weights in pounds.")
parser.add_argument("--tens", action="store_true", help="Print only the Tens wave")
parser.add_argument("--eights", action="store_true", help="Print only the Eights wave")
parser.add_argument("--fives", action="store_true", help="Print only the Fives wave")
parser.add_argument("--threes", action="store_true", help="Print only the Threes wave")
args = parser.parse_args()
selected_wave = None
if args.tens:
selected_wave = 'Accumulation'
elif args.eights:
selected_wave = 'Eights'
elif args.fives:
selected_wave = 'Fives'
elif args.threes:
selected_wave = 'Threes'
process_multiple_weights(args.max_weights, selected_wave)
if __name__ == "__main__":
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment