Lifting warmup plate calculator
I “wrote” this using an LLM and a simple prompt:
I want to make a page that has a javascript calculator for working out how to structure the warmup sets for someone weightlifting in a gym using a barbell.
It should assume the plates available are 1.25kg, 2.5kg, 5kg, 10kg, 15kg and 20kg. It can also optionally let the user select the size of their ‘micro plates’ if they have them.
The user should be able to choose how many warmup sets they want to do, and what their target lifting weight is.
The calculator should find the most even way of ramping its way up from an empty bar (20kg) to their target weight, in the chosen number of warmup sets, but of course accounting for the available plates
and was suprised by the output! It gave me some HTML, css, and js that I put directly into this page above. I then provided a couple of follow up prompts:
The html, css, and js provided is almost perfect. I would like to make one change. I need it to give a meaningful error if it is not possible to achieve the chosen target weight with the plates available.
and
The user can only ever add a single microplate or zero microplates - never more
And you end up more or less with what I had here! I had to make one quick manual edit as well, to adjust the number of sets - it was written to take the number provided as the total number of steps, but I wanted it to take the number of warmup steps (i.e. if you said 3 it meant you needed 5 total, to account for the empty bar at the start and the fully loaded bar at the end)
This was so quick and straightforward for the LLM to create because this problem isn’t exactly novel. I used Claude3-Sonnet via Perplexity, so it even showed me the citations it used - which were solving extremely similar problems.
To make this into a “proper” piece of work, there are more changes that I couldn’t be bothered to make. Some of them are:
- It could bias towards ‘simple’ steps (try to keep using plates already on the bar instead of always starting again with the biggest plate that fits)
- If the jumps aren’t totally even, then the uneven jumps should be earlier in the warmup
- Add literally any sort of tests to check it actually has an optimal solution