Created
March 2, 2010 14:31
-
-
Save unixmonkey/319543 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
puts "\n** This is a regimen calculator based on the \"Get In Shape\" post on" | |
puts "** Justin Cunningham's \"Little Bit of Code\" blog post at" | |
puts "** http://littlebitofcode.com/2010/03/01/get-in-shape **\n\n" | |
class LiftCalc | |
attr_accessor :maxweight | |
def initialize | |
@maxweight = 0 | |
end | |
def new | |
end | |
def calculate(checkweight, reps) | |
@maxweight = ( checkweight.to_i / ( 1.0278 - ( 0.0278 * reps.to_i )) ) | |
round_down(@maxweight) | |
end | |
def round_down(weight, nearest=5) | |
(weight/nearest.to_f).round * nearest | |
end | |
def max_percent(percentage) | |
weight = (@maxweight * percentage.to_i) / 100 | |
round_down(weight) | |
end | |
end | |
puts "Pick a weight you think you can lift between two and 10 times, but no more." | |
print "Weight (in pounds): " | |
checkweight = gets.chomp | |
puts "\nAwesome. Do some reps of #{checkweight} pounds and tell how many you were able to do." | |
print "How many did you do: " | |
reps = gets.chomp | |
lc = LiftCalc.new | |
weight = lc.calculate(checkweight, reps) | |
puts "\nHmmm. The max weight you should safely do is:" | |
puts "*******************" | |
puts "*** #{"%.2f" % weight} pounds **" | |
puts "**** pansy ass ****" | |
puts "\nNow that's out of the way, here's the regimen I want you to do today." | |
puts "Try and do this:" | |
puts "15 reps of #{lc.max_percent(45)} lbs" | |
puts "7 reps of #{lc.max_percent(60)} lbs" | |
puts "5 reps of #{lc.max_percent(75)} lbs" | |
puts "3 reps of #{lc.max_percent(85)} lbs" | |
puts "2 reps of #{lc.max_percent(90)} lbs" | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment