EatDrink.ash: Optimize your daily diet (and see how your old diet stacks up).

BladeLight

Member
Eatdrink.ash is not filling up my spleen completely... It will fill me to 13 then stop. But if I rerun it, it will fill me up to full. Why is this happening?
 

fronobulax

Developer
Staff member
Eatdrink.ash is not filling up my spleen completely... It will fill me to 13 then stop. But if I rerun it, it will fill me up to full. Why is this happening?

IIRC this comes up a lot and it is because of your price and cost related settings and market fluctuations. Basically, for your settings there are no spleen items that are good enough. I can't recall which setting was must useful for tweaking spleen, though. CLI out put is good or just increase value of an adventure.
 

Theraze

Active member
Nope.... more likely that BladeLight is using a low STEP_MEAT and it's full. Best guess... 5000 STEP_MEAT, and it's buying 13 twinkly wads @~380 meat each, then it's unable to do any more.

Set STEP_MEAT to 10k, 20k, or -1 if you want it to complete in one. Depending on how much you want it to spend. -1 means use as much as you need to for Value of Adventure, 10k means don't spend more than 40k total (10k * 4 steps), and 20k means don't spend more than 80k total.
 

BladeLight

Member
Ah... thanks :D -1 it is

Also, is the Value of Adventure value the MPA I get when I'm farming or is it some fancy equation I have to put my MPA through?
 
Last edited:

Winterbay

Active member
It's what you think an adventure is worth for you, so the mpa you get when farming is probably the best bet there. Nothing more fancy should be necessary.
 

Theraze

Active member
Yes/no. Think about VoA as how much you're willing to spend to get another adventure, not how much profit you're planning on making for that adventure.

2000 Meat Gained Per Adventure (MGPA)
500 VOA gets you 120 adventures
2000-500=1500 Profit per adventure (PPA) multiplied by 120 for 180,000 total profit.
1250 VOA gets you 180 adventures
2000-1250=750 PPA multiplied by 180 for 135,000 total profit.

2500 MGPA
500 VOA gets you 120 adventures
2500-500=2000 PPA multiplied by 120 for 240,000 total profit.
1250 VOA gets you 180 adventures
2500-1250=1250 PPA multiplied by 180 for 225,000 total profit.

3000 MGPA
500 VOA gets you 120 adventures
3000-500=2500 PPA multiplied by 120 for 300,000 total profit.
1250 VOA gets you 180 adventures
3000-1250=1750 PPA multiplied by 180 for 315,000 total profit.

So even though each adventure actually gains you less, your total profit eventually goes up. But the decision on how much your VOA should actually be... that's something that takes a lot of math. And knowledge of your meat gained per adventure. But with that, and a few simulation executions of EatDrink with different VOAs to see how many sample adventures you're comparing.

Or, if you're lazy and don't want to think too hard... just cut your MGPA in half or quarter it. That should mean you always make a profit, but still get some decent adventures.
 

Winterbay

Active member
On that note: Is it possible to get eatdrink to report back an integer (or a range) of how many turns it thinks it'll get for a given VOA? (for potential simulation running in a farming script or so)
 

Theraze

Active member
Potentially... I'll check if changing the main eatdrink() to return an int allows that. Believe it will, which would allow automation. I could even do it in the script (and do, to a VERY limited extent, by calculating if you'd get more total adventures by dropping your VOA down), but calculating profit makes it a much more complicated check where bigger isn't always better. :)

But yeah... next release, which I'll spin (to thread) in a week or so if reminded when I get back from Montana, should have the int returned from the eatdrink(food, drink, spleen, overdrink) function. If you call the overloaded, it goes away, since that calls the 4 function ED. If you call main, it goes away. This should make it transparent for current users, but allow scripters to gather useful information. :)
 

eegee

Member
In the meantime you can do:
PHP:
import "EatDrink.ash";
...
void foo() {
  SIM_CONSUME = true;
  // eatdrink(fullness_limit() - my_fullness(), inebriety_limit() - my_inebriety(), spleen_limit() - my_spleen_use(), false);
  eatdrink(X, Y, Z, false);
  int bar = get_adventures();
}
bar = "how many turns it thinks it'll get for a given VOA" :p
 

Theraze

Active member
Yes/no. Remember that simadventures is based on your starting adventures as well, so you need to do get_adventures() - startadventures.
 

xKiv

Active member
Yes/no. Think about VoA as how much you're willing to spend to get another adventure, not how much profit you're planning on making for that adventure.

Considering what actually happens in the source of the script, at least in the version I have, EatDrink tries to maximize (adventures_generated * valueOfAdventure - cost_of_diet), which means this is POW (plain old wrong).
You have (at least) three choices of what you actually want:
1) maximize profit; then you should put valueOfAdventure at exactly how much meat you expect from getting 1 extra adventure (and only from that last adventure - don't count any adventures spent doing limited-per-day things, or profits from anything that doesn't spend adventures)
2) maximize adventures given your V="this is how much I am willing to spend on one adventure" (you are maximizing (adventures_generated) with the constraint (cost_of_diet <= adventures_generated*V); in this case, you still shouldn't put valueOfAdventure=V, because that will always generate less adventures than the optimum (except in trivial cases like when the optimum is 0), because the optimum will invariably produce profit of zero, which is nowhere near the profit you *could* get even with 1 adventure) - what you can do is try running ED with different values of VoA and see where the reported profit is closest to 0, that's the diet you want in this case; but the relationship between V and "optimal VoA" will depend on too many things, including current mall prices
3) maximize adventures given your W="this is how much I am willing to spend on the entire diet" (maximizing (adventures_generated) with the constraing (cost_of_diet <= W) - again non-trivially different from the previous cases; you sill still get some results running ED with different VoAs, but the relationship between "optimal VoA" and W will be even less comprehensible)

and do, to a VERY limited extent, by calculating if you'd get more total adventures by dropping your VOA down
You should never get more adventures by dropping VoA, unless you have bugs.

Let's see for a contradiction, what if you could:
step 1 - VoA = V1, optimal diet D1 costs C1 and generates A1 adventures for profit P1=V1*A1-C1
step 2 - VoA = V2 < V1, diet D2 costs C2 and generates A2 > A1 adventures for profit P2=V2*A2-C2
now, it must be that C2 > C1, or else D2 would also be better than D1 in step 1 (it would have profit V1*A2-C2, where V1*A2 > V1*A2 and -C2 >= -C1, V1*A2-C2 > V1*A1-C1)
(ok, it's optimal for generating more adventures, so it costs more, makes sense)
but, why is D1 better than D2 at V1? must be that V1*A1-C1 > V1*A2-C2, and therefore V1*(A1-A2) > C1-C2;
flipping for postitive numbers (assuming V1>=0) of both sides gives C2-C1 > (A2-A1)*V1
and, why is D2 better than D1 at V2? that's V2*A1-C1 < V2*A2-C2, and therefore V2*(A1-A2) < C1-C2;
flipping for positive numbers (assuming V2>-0) gives C2-C1 < (A2-A1)*V2
but V1 > V2, so C2-C1 > (A2-A1)*V1 > (A2-A2)*V2 > C2-C1
ergo, C2-C1 > C2-C1, contradiction.
Best case, this other diet can give you exactly the same amount of adventures for the same cost.
 

Catch-22

Active member
VoA is how much value you place on the adventure itself. So, if you're talking pure meat, let's say you make 650 meat per adventure on average, if you want to maximize your profits (when farming, for example) your VoA should be 650.

Of course, adventures can have "sentimental" value, such as how much value you might put on a run being finished a day sooner by spending slightly more meat per adventure than what you're actually getting back. Of course, in the true sense if you're spending more meat than you're making across an entire ascension, your capital would eventually dry up and you would run out of meat. That's likely not going to happen any time soon, unless you set your VoA to something ridiculously unsustainable like 5000 or something (mmm a diet consisting entirely of grimacite bock and gray cheese :)).
 

Theraze

Active member
EatDrink works based on the VOA being how much you're willing to spend to get another adventure, like I said. Despite what you guys say, the math it uses doesn't work based on profit or other exciting things like that. Also, if your VOA is 1000 (and it spends that much) and you make 1000 meat per adventure, you actually have a profit of... 0.

Regarding lower VOA giving higher total adventures... that involves the actual item choice. If you can get rockin' wagons for 300 meat, they may be 'better' than gimlets at 5000 meat, as long as your VOA is less than 4700/4. Less adventures, but it's better for your total profit based on what you've given the script. Sometimes if you drop your VOA, your item choice changes... sometimes not in the ways you'd expect, but the math always works out when you try it and actually work it out fully. -_-

Part of the way that works though, is that when we start dropping your VOA, we just compare the 'best profit' option with 'best profit' for adventures. We aren't comparing maximum adventures... we're comparing best profit for adventures.
 
Last edited:

lostcalpolydude

Developer
Staff member
EatDrink works based on the VOA being how much you're willing to spend to get another adventure, like I said. Despite what you guys say, the math it uses doesn't work based on profit or other exciting things like that. Also, if your VOA is 1000 (and it spends that much) and you make 1000 meat per adventure, you actually have a profit of... 0.

It's only the last adventure(s) gained that give a profit of 0 in that case. Most of the adventures were generated for 100 meat, or 300, or 800, or whatever. The idea that you should keep generating turns until generating another turn would give 0 profit seems pretty straightforward.
 

Theraze

Active member
It's only the last adventure(s) gained that give a profit of 0 in that case. Most of the adventures were generated for 100 meat, or 300, or 800, or whatever. The idea that you should keep generating turns until generating another turn would give 0 profit seems pretty straightforward.

Not true... if you earn 1000 meat per adventure, and you're spending 1000 meat per additional adventure, it doesn't matter if you burn 1 turn or 1000 turns... your profit is still 0. (1000-1000)*X=0, regardless of your value of X.

This is why EatDrink works based off of the best possible profit for your VOA, not based on spending your VOA entirely.

Look at my profit per adventure sample above... it really does make sense. :(
 

lostcalpolydude

Developer
Staff member
Not true... if you earn 1000 meat per adventure, and you're spending 1000 meat per additional adventure, it doesn't matter if you burn 1 turn or 1000 turns... your profit is still 0. (1000-1000)*X=0, regardless of your value of X.

I don't disagree with that. It's just that the "you're spending 1000 meat per additional adventure" part is only going to apply to a very narrow portion of the possibilities for gaining an additional adventure.

Unless all you do for a given diet is [ totalAdventures / totalCost ] and comparing that to VoA, in which case EatDrink is fundamentally flawed.

Look at my profit per adventure sample above... it really does make sense.
Are you saying that lowering VoA switches from rockin' wagons to gimlets somehow? If it switches the other way, then it's a case of lower VoA => fewer adventures and has nothing to do with lower VoA => more adventures.
 
Top