JavaScript functions to disperse ingredients based on Protein, Carbs and Fat
$10-30 AUD
Sürüyor
İlan edilme: 4 yıldan fazla önce
$10-30 AUD
Teslimde ödenir
Given a base of:
NF grams of Fat
NP grams of Protein
NC grams of Carbs
And a meal that consists of
IngredientA
3% Fat
6% Protein
3% Carbs
50g minimum serving
IngredientB
Ingredient B1
10% Fat
3% Protein
2% Carbs
1g minimum serving
Ingredient B2
2% Fat
10% Protein
0% Carbs
120g minimum serving
IngredientC
6% Fat
2% Protein
3% Carbs
5g minimum serving
Have a function that returns the best combination of ingredients A, B and C, in grams, getting to the closest combination of NP, NC and NF, based on the below requirements:
- The ingredient list is not limited to 3, it could be 5, 10, 15 ingredients.
- Ingredients like IngredientB are made up of two ingredients, which need to be incremented at the correct ratio. If you incrememnt B2 by 1g, you need to increment B1 by 0.008g.
- The minimum required serving for each Ingredient must meet the 'minimum serving' requirement, i.e. you need to have at least 50g of Ingredient A
- The ingredients must be incrememnted by at least 1 gram.
- The ingredients should be increased roughly related to each other (i.e. the result SHOULDN'T be 90% of a single ingredient)
- NF, NP and NC aren't at fixed ratio, i.e you could have 10NF 10NP 40NC or 5NF 100NP 22NC.
Technically:
- ES6 is welcomed
- This will be run in node, so as modular as possible - if not modules then just split up into functions i can run unit tests on.
Hi. thanks for your posting.
I'm very happy to have a chance of bidding your project.
I have experience in development of the projects like yours
If you hire me, I'll do my best for your project and finish greatly in a short time.
I'm sure I can satisfy for you as you want.
Best regards.
I can build you a function with the given requirements. I will be building it in a day but taking into account some buffer time which can be accounted into if some unavoidable conditions occur.