I'm a geek at heart, and it pains me to still be inept at programming and coding. Once upon a long time I was the Mac packager for Wesnoth, but I'm very much self-aware of my deficiencies. The lack of knowledge + skill plus the transition from student life to housemanship made me readily give up the role to people who professionally have a background in programming. I'm interested in just learning the ways and make programs that I can use to help myself in my daily activities (certainly not to make a fortune, though that'd be nice). For many years, the effort has never been consistent. I want to try again, now with Swift (previously tried out Objective-C but I failed miserably to get anywhere).
One area I want to try is to make a program to log my 5/3/1 progress. Currently I use Numbers to calculate my weights automatically (by keying in my training maxes) and log progress (with 5/3/1's estimated 1RM calculator):
So now I'm trying to learn programming again; my mania has taken over (with help of copious amounts of home cold brewed coffee). Currently I've managed to write something in Swift that will calculate my training max (for now based on my true max) and subsequent training weights, with say my deadlift:
import UIKit var helloPlayground = "Hello, playground" print(helloPlayground) class Lift { var liftName = String() var kg = "kg" var liftTrainingMax = Double() var liftLiftingMax = Double() var weight = Double() var percentage = Double() func calculateLiftTrainingMax(using liftLiftingMax:Double){ liftTrainingMax = 0.9 * liftLiftingMax print("Say that my \(deadlift.liftName) max is \(deadlift.liftLiftingMax) kg \nMy training weights will be:") } func calculateLiftWeights (){ var percentage: Double = 0.4 var liftWeights = [percentage:weight] while percentage < 1 { var weight = percentage * liftTrainingMax percentage = (percentage*100).rounded()/100 weight = (weight*10).rounded()/10 liftWeights [percentage] = weight percentage += 0.05 } for (percentage, weight) in liftWeights.sorted(by: <) { print ("\(Int(percentage*100))% : \(weight) kg") } }} let deadlift = Lift() deadlift.liftName = "deadlift" deadlift.liftLiftingMax = 100 deadlift.calculateLiftTrainingMax(using: deadlift.liftLiftingMax) deadlift.calculateLiftWeights() deadlift.liftTrainingMax = 211 print("\nSay that I've a preset training max of \(deadlift.liftTrainingMax) kg (my actual current training numbers)\nNow my training weights will be") deadlift.calculateLiftWeights()
And it's subsequent output:
Hello, playground Say that my deadlift max is 100.0 kg My training weights will be: 40% : 36.0 kg 45% : 40.5 kg 50% : 45.0 kg 55% : 49.5 kg 60% : 54.0 kg 65% : 58.5 kg 70% : 63.0 kg 75% : 67.5 kg 80% : 72.0 kg 85% : 76.5 kg 90% : 81.0 kg 95% : 85.5 kg Say that I've a preset training max of 211.0 kg (my actual current training numbers) Now my training weights will be 40% : 84.4 kg 45% : 95.0 kg 50% : 105.5 kg 55% : 116.1 kg 60% : 126.6 kg 65% : 137.2 kg 70% : 147.7 kg 75% : 158.3 kg 80% : 168.8 kg 85% : 179.4 kg 90% : 189.9 kg 95% : 200.5 kg
My mania has led me to pay quite an amount to resubscribe to the Apple Developer Membership, and yes, I'm using the Developer beta's for iOS 12 and MacOS Mojave (which are actually much more stable than even the first public beta's for the previous versions of the 2 OS'es). I'm currently learning a bit from Youtube and trying things out (with Google, you can search anything for help quickly without thorough browsing of the documentation). Let's see where this rabbit hole will take me.