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

dj_d

Member
EatDrink 3.2
your fast food source

EatDrink.ash will attempt to fill you up with the finest vittles, firewater, and spleenables that the kingdom has to offer - and that you can afford. It considers things like prices, the relative value of adventures and stats, whether you have to pull or purchase the item, and so on. It even ends your day with a bang by overdrinking (if you tell it to). Here's how to use it.


  1. From kolmafia, type "EatDrink.ash". At the prompts, enter "15" for foodMax, "19" for drinkMax, "15" for spleen, "true" for overdrink, and "true" for simulate_only. Observe as it recommends a diet, and compares it to your favorite foods.
  2. Edit the config file for your character (see zlib for details on how the config file works) and try modifying VALUE_OF_PRIME_STAT, and VALUE_OF_NONPRIME_STAT. These will affect how much you're willing to spend to get the comparative increases. Then run again, until you like what you see. Be sure to do it in the config file, as changes in the actual script won't make a difference (the script just sets defaults).
  3. Change mafia's valueOfAdventure variable using "set valueOfAdventure=X", filling in the value you want for X.
  4. Ready to turn over your daily diet? Fool! Run it again, choosing "false" for sim_only, and unleash havoc on your belly (and liver, and spleen).
Since this script uses actual live prices, it will produce different results on different days. That means that if something tasty crashes in price, it will switch you over from your regular diet - or if your regular diet gets bid up in the store, you'll seamlessly move over to something more affordable.

It will even cope with misreported prices - that is, if the pricing sources are wrong. If it tries to buy something for the reported price and fails, it will update the "last known good" price to reflect that, and recalculate. It may iterate a few times, bidding more each time, but it will eventually figure out that it can't get the item for that price and something else will pop to the top of the stack.

Other features:

  • Buys milk of magnesium if it's cost-effective, and takes Ode into account
  • Ditto for the chocolate families (fancy chocolates, vitochocanutriment capusles, etc)
  • If you have a TPS, will do smart things with pricing & crafting TPS drinks
  • If you have a key lime pie & don't have the corresponding key, it gets eaten first
  • Lets you simulate low-level ronin play for ascension planning (via SIM_LEVEL and SIM_RONIN)
  • Crafts food if you have all the components
  • Summarizes results/recommendations at the end
  • Uses zlib.ash and plays nicely with it and other scripts that use it
  • Uses live and historical prices
  • If you have ever consumed something, it will permanently put it on the "check daily" list and check pricing more aggressively
  • Consider and use tuxedo shirts
Bug reports are nice; bug fixes are nicer. :)


Installation Instructions
Distribution has migrated over to SVN. With a current daily build, please copy/paste the following line into KoLmafia's CLI and press enter:
Code:
svn checkout https://svn.code.sf.net/p/therazekolmafia/eatdrink/code/


Huge thanks to Sandiman; I based this on his reportConsumables script. Ditto Zarqon for zlib and general advice and improvements. Ditto zecious babaloni for running the old pricing service that this used to use. Ditto degrassi for the versioning. And most importantly, huge thanks to the kolmafia dev team who made this all possible!


Moderator update.
valueOfAdventure is a KoLMafia property. You can set it by typing set valueOfAdventure = 1000 in the gCLI.

10 MAR 2011
Fronobulax here, taking advantage of my developer status with elevated editing privileges. The failure of EatDrink to check for updates the way God, or zarqon, intended combined with the proliferation of versions has compelled me to take action. Henceforth I will keep my support for EatDrink in one place, here. I will post versions and update version numbers.

V3.1 is the "latest" version and re-establishes a baseline. Compared to Theraze's version here this version has code from Bale that improves the handling of fancy chocolates, lacks the code from Bale et. al. that changes the parameters to strings when EatDrink is invoked directly and retains code for handling Ode To Booze as part of a mood that is absent in Theraze's version. I am willing to discuss adding those features but I wanted to start off with a script that I had tested.

15 MAR 2011
V3.1.1 - Changed local variable names to avoid name conflict with OCD. Deleted use of moods to control Ode to Booze as per Theraze.

02 APR 2011
V3.1.2 - Do not save what was consumed as a eatdrink_daily variable since that tends to clutter up data files for no purpose. Also use $item[none] rather than make a special case for the Genalen bottle.

16 APR 2011
V3.1.3 - Theraze's tweaks to better handle cases where item cannot be consumed because of price or other constraints.

16 SEP 2011
V3.1.5 - Skipped 3.1.4 to avoid confusion with extended beta development after 3.1.3. DO NOT use this version until after you upgrade to KoLmafia 14.8. In general, this version is better at obtaining items before they are consumed and adjusting The Plan if it cannot get what it expects. See This post for more details.

01 JAN 2012
No update but this post has some good information about EatDrink parameters.

28 JAN 2012
Updated. See detailed notes in #1433. Most significant change seems to be that drunki-bears are avoided. Also note, since it doesn't seem to be noted elsewhere, that EatDrink requires zlib in your scripts directory in order to run.

28 JAN 2012 Whoops. Got overdrink failure logic backwards and fixed it. Bumping version because that's how I roll.

21 OCT 2012 - 3.1.8 - Better handling of lasagnas. Added support for Boris and Zombie runs.

12 JAN 2013 - 3.1.9 - Better handling of boxen creation. zLib variable is now controls price to create rather than just YES/NO. Better support for Carboloading trophy. Added mr. mediocrebar support. Thanks, Theraze.
 
Last edited by a moderator:
Re: EatDrink:a script to fill up optimally. Tomorrow you may be beaten up!

Enjoyed the Epicurean thread title. You should include a "Eating and drinking complete. Be merry at your own discretion." at the end of your script.

This must be that mysterious big project you've been mentioning eh? Looking forward to checking it out later today! (Whereupon I'll have to edit this post so it makes sense. :) )

EDIT: Yep, makes no sense now. You even changed the thread title.
 
Speak up lurkers! Eager to hear what you think of it. :)

Anyone know how to suppress the overdrink prompt? I'd like to give the option of having this run fully unattended. One click moveable feast (OCMF?), if you will.
 
[quote author=dj_d link=topic=2038.msg10090#msg10090 date=1228198179]
Anyone know how to suppress the overdrink prompt? I'd like to give the option of having this run fully unattended. One click moveable feast (OCMF?), if you will.
[/quote]

Yes, this.

Code:
Revision: 6512
Author: jasonharper
Date: 22:07:59, woensdag 19 november 2008
Message:
Adds "overdrink" command to CLI, which behaves exactly the same as "drink"
except that there won't be any confirmation dialogs if this would get you
falling-down drunk with turns remaining, or if you don't have enough MP to
cast Ode to Booze. Useful if you need to queue up some actions before
rollover and won't be around to answer any dialogs.

Also, the script looks very interesting. I plan on trying it out soon and am excited to see how it works out. Thanks for the hard work.
 
Thanks dangerpin! I'm always surprised what it turns up... it's clear that my diet has usually been suboptimal. And so, I suspect, has almost everyone else's. I have to say that I seriously considered stocking up on a few of the high-value foods the script suggested in anticipation of a price increase... :)

Thanks for the info on overdrink(). On a related note, is there some way to conditionally include code depending on the kolmafia version? I hate to produce scripts that can only be run on experimental versions, and there's a few functions I'd add if I could be sure they wouldn't break users of the "release" build.
 
Frig, this is a huge and impressive undertaking. (Scripts don't often make me say 'frig.') I'm still processing it, but so far I'm very impressed. I'd like a way for this script to only have to filter stuff once, instead of between every item consumption, particularly if SIM is true, since with SIM on there would be no unexpected results. It would really speed it up. I think moving filter_availability() before the while loop and decrementing map_today[it].numOwned in consume_one() ought to do it.

Also, I think auto-spading the number of adventures gained (you're doing that right?), unless it can take into consideration moon sign and consumption helpers, is a bit dangerous.

[quote author=dj_d link=topic=2038.msg10109#msg10109 date=1228279341]
there's a few functions I'd add if I could be sure they wouldn't break users of the "release" build.
[/quote]

As others before me have pointed out, there's not really anything differentiating a release build from a daily build, except that no one knew of anything broken at the time it was released. The most recent "release" build is from before all the crafting changes! (i.e. it basically doesn't work anymore.) Just write for the most recent daily... besides, I think most of the users who d/l scripts from here also keep up with the daily builds.

Nice work, dj_d! After I test it enough to satisfy myself with it, this script will probably become a vital part of my HC runs.
 
Two things,
1) The script says it needs to be updated but i can't find a ver 1.03 script, Not sure if maybe you just forgot to change the value or if i can't find the new ver.
2) Update_from_mafia() keeps causing the scipt to create an unexpected error... i didn't trace it any further then that though.
 
Zarqon, Paragon, thanks! You guys are two of the most impressive script authors around, so I appreciate your feedback.

ver.ash caches its results for the day. That can cause the version check to fail even when you're current. I've included a fix in 1.04.

With you 100% on inefficiencies in calculation. While there's more room for improvement, 1.04 recalculates only the values & availability of the items you consume, so each iteration after the first goes faster.

Autospade suggestion is a good one. 1.04 turns it off by default with a config variable. Suggestions for how to get around this (even as simple as not autospading when stat days or effects are present) are welcome.

I'll take a look at update_from_mafia, but if you could narrow it down a bit, that'd be helpful.
 
Re: EatDrink:a script to fill up optimally. Tomorrow you may be beaten up!

[quote author=zarqon link=topic=2038.msg10061#msg10061 date=1228002585]
EDIT: Yep, makes no sense now. You even changed the thread title.
[/quote]

It's still there in the subtitle, though. :)
 
v1.04

I'm going to start posting new versions in the thread so the old versions are archived somewhere. Don't use this, use the one in the first post.
 

Attachments

Also, moving version history to the thread.

Version history:

* 1.0: release
* 1.01: fixed divide-by-zero bug that only manifests on build 6517 and later
* 1.02: If you don't have enough meat in your inventory, it will still recommend eating items (but not buying them). Also, you can call with more parameters if you're calling from a script. You will need the attached eatdrink_drink_data.txt and eatdrink_drink_data.txt (or add a column of 0s to the right of your existing one).
* 1.03: Fixed a bug wherein if you aborted over-drinking, it would conclude that the drink provided 0 adventures and enter autospade results accordingly. Also, don't recommend shop-ables if you're not simulating and you're in ronin or hardcore.
* 1.04: If an item can't be bought, it re-calcs the value of the item at the new, higher price. Minor efficiencies in recalculating. You can import the script and call it with custom parameters (void eatdrink(int foodMax, int drinkMax, boolean overdrink, int advmeat, int primemeat, int offmeat, int pullmeat)). Fixed the version number and changed ver.ash to not fail the version check twice in one day (gets around a bug as well as being less annoying).
 
Could you provide a summary at the end of the report? The calculations for drinks started too soon for me to read the food recommendations.
 
[quote author=caphector link=topic=2038.msg10298#msg10298 date=1228768001]
Could you provide a summary at the end of the report? The calculations for drinks started too soon for me to read the food recommendations.
[/quote]

Something that sums it all up is definitely needed. I'm confused at to what my new diet should be...
 
1.06 cleans up summary output and fixes a bug in pricing - basically, the "cost" of a pull was added to the price. No longer. It also prints out the assumptions being used in the summary to facilitate debugging. New functionality for planning ascensions: set SIM_LEVEL to your planned level (e.g. 4) and SIM_RONIN to true, and it'll calculate as if you were level 4 ronin (i.e. include pull costs). Known bug: if you're simulating, it will recommend consuming the same item many times, even if you only own one.
 

Attachments

I just updated getonbudget.ash as well to fix a significant bug with buying multiple items at once. eatdrink.ash doesn't do that so the bug wasn't affecting users of the script.
 
I'm trying to understand the recommendations that EatDrink.ash is making. Trying to get max adventures from food/drink, don't care about stats. So currently VALUE_OF_ADVENTURE is 100,000, budget is 1,000,000. For my diet it's recommending Jarlsberg's Key Lime Pie x3, a cup of Mulligan Stew, and a Knob Pasty, which it calculates at 71 adventures.

I'd been eating three Hi Meins a day, which average at 75 adventures. Is there a reason that pies are getting recommended over meins?

Drinks calculations make a lot more sense; it recommends either Knob Coffee or Ralph IX cognac, which are far better than my normal Dirty Martinis.

Thanks for the script; it's nice being able to run simulations.
 
That's not a bug, it's a feature! :)

The attached version has a PIE_PRIORITY flag. If true, then if you're missing a key (and your level permits) you'll make the corresponding pie a priority. That's the current behavior. You want that set to "false". It's very handy for brainless consumption during an ascension, though, as you never find yourself at the NS with 15 fullness, three pies, and no keys.

I'm not going to rev main yet but when I do this'll be in it.

I haven't run it with high thresholds, let me know what you wind up with! Just paste the summary in to the thread.
 

Attachments

Bug fix:
Line 807 should be:
summarize("Now at fullness of "+get_fullness()+", eating to "+foodMax+".");

Thanks for the PIE_PRIORITY flag; that made a big difference.

It's interesting watching the interplay between VALUE_OF_ADVENTURE and BUDGET; if you leave the VALUE_OF_ADVENTURE low with BUDGET high it goes for the most cost-effective expensive consumables.

Here are my test runs:

With BUDGET = 100,000, Value_of_Adventure at 10,000:
Code:
Now at fullness of 0, eating to 15.
2: frozen banquet lev:15 gain:6.0 adv:45.0 musc:194.5 myst:194.5 moxie:194.5 price:54000 own:0 value:66097
5: Knob pasty lev:1 gain:1.0 adv:6.5 musc:5.5 myst:5.5 moxie:5.5 price:10969 own:0 value:54047
Now at inebriety of 0, drinking to 19.
19: thermos full of Knob coffee lev:1 gain:1.0 adv:6.5 musc:5.5 myst:5.5 moxie:5.5 price:16400 own:0 value:48616
Now finishing with one big stiff drink.
20: jar of squeeze lev:8 gain:7.0 adv:28.0 musc:35.0 myst:35.0 moxie:35.0 price:43990 own:0 value:202384
Finished. Spent 496497 meat. Gained Fullness: 15. Inebriety: 26. Adventures: 250. Muscle: 533. Moxie: 533. Mysticality: 533.

With BUDGET at 20-50,000, Value_of_Adventure at 10-20,000:
Code:
Now at fullness of 0, eating to 15.
15: Knob pasty lev:1 gain:1.0 adv:6.5 musc:5.5 myst:5.5 moxie:5.5 price:10969 own:0 value:54047
Now at inebriety of 0, drinking to 19.
19: thermos full of Knob coffee lev:1 gain:1.0 adv:6.5 musc:5.5 myst:5.5 moxie:5.5 price:16400 own:0 value:48616
Now finishing with one big stiff drink.
20: jar of squeeze lev:8 gain:7.0 adv:28.0 musc:35.0 myst:35.0 moxie:35.0 price:43990 own:0 value:202384
Finished. Spent 520125 meat. Gained Fullness: 15. Inebriety: 26. Adventures: 232. Muscle: 205. Moxie: 205. Mysticality: 205.
Eating and drinking complete. Commence merrymaking (at your own discretion).

With BUDGET at 200,000, Value_of_Adventure at 100,000:
Code:
Now at fullness of 0, eating to 15.
7: tin cup of mulligan stew lev:15 gain:2.0 adv:17.0 musc:487.5 myst:656.0 moxie:544.0 price:98500 own:4 value:801593
8: Knob pasty lev:1 gain:1.0 adv:6.5 musc:5.5 myst:5.5 moxie:5.5 price:10969 own:0 value:639047
Now at inebriety of 0, drinking to 19.
9: Hodgman's blanket lev:15 gain:2.0 adv:15.0 musc:550.0 myst:550.0 moxie:550.0 price:129000 own:1 value:686325
10: thermos full of Knob coffee lev:1 gain:1.0 adv:6.5 musc:5.5 myst:5.5 moxie:5.5 price:16400 own:0 value:633616
Now finishing with one big stiff drink.
11: jar of fermented pickle juice lev:13 gain:5.0 adv:32.0 musc:90.0 myst:90.0 moxie:90.0 price:90000 own:0 value:2488220
Finished. Spent 1967869 meat. Gained Fullness: 15. Inebriety: 24. Adventures: 298. Muscle: 8459. Moxie: 8858. Mysticality: 9642.

With BUDGET at 10,000, Value_of_Adventure at 10,000:
Code:
Now at fullness of 0, eating to 15.
3: sleazy hi mein lev:7 gain:5.0 adv:25.0 musc:26.5 myst:27.0 moxie:73.0 price:288 own:7 value:49968
Now at inebriety of 0, drinking to 19.
4: prussian cathouse lev:6 gain:4.0 adv:16.0 musc:0.0 myst:0.0 moxie:43.5 price:320 own:0 value:39930
7: cup of primitive beer lev:12 gain:1.0 adv:3.5 musc:57.5 myst:0.0 moxie:0.0 price:1250 own:0 value:33807
Now finishing with one big stiff drink.
8: grogtini lev:6 gain:6.0 adv:24.0 musc:18.0 myst:0.0 moxie:0.0 price:2156 own:0 value:198222
Finished. Spent 8050 meat. Gained Fullness: 15. Inebriety: 25. Adventures: 172. Muscle: 267. Moxie: 391. Mysticality: 81.
 
Back
Top