Search code examples
pseudocode

Convert calories to weight


The fundamental equation of weight loss/gain is:

weight_change = convert_to_weight_diff(calories_consumed - calories_burnt);

I'm going on a health kick, and like a good nerd I thought I'd start keeping track of these things and write some software to process my data. I'm not attentive and disciplined enough to count calories in food, so I thought I'd work backwards:

  • I can weigh myself every day
  • I can calculate my BMR and hence how many calories I burn doing nothing all day
  • I can use my heart-rate monitor to figure out how many calories I burn doing exercise

That way I can generate an approximate "calories consumed" graph based on my exercise and weight records, and use that to motivate myself when I'm tempted to have a donut.

The thing I'm stuck on is the function:

int convert_to_weight_diff(int calorie_diff);

Anybody know the pseudo-code for that function? If you've got some details, make sure you specify if we're talking calories, Calories, kilojoules, pounds, kilograms, etc.

Thanks!


Solution

  • Look at The Hacker's Diet and physicsdiet.com - this wheel has already been invented.