Cravings and Food Likes/Dislikes

Before I start, I really want to thank the StoneHearth team for their contribution to my life. It’s been a while since I’ve written a “book” post like this for anything, and I feel totally accomplished even though I can’t progress further with this idea alone. This suggestion requires a strong comprehension of math that I do NOT have. I didn’t expect to get sucked into this as much as I did. And even if nobody likes it, or even if it’s too complex or complicated to include, I had a lot of fun examining the possibilities.

So, on with the show:

#Food Favorites

Each Hearthling has his own independent favorite food list.
Of these foods, one of them will always be a “loved” food and one will be a “most disliked” food.
As a Hearthling tries new foods, this list can change over time.
A new food can replace a “loved” food or a “most disliked” food.

In practice:

  • Stephanie loves Corn.
  • Stephanie also likes Turnips and Carrots.
  • Stephanie doesn’t really like Pumpkins very much.
  • Stephanie doesn’t like Golden Gourds at all.


Stephanie eats a Corn Bread and decides it will be her new favorite food. This dislodges Corn from the “loved” position into “liked”.


#Food craving rating

Each food will have a percentage-based rating.
Craving ratings determine which foods a Hearthling will choose when it is time to eat.
The highest rating food in the Hearthling’s food list will be the food chosen.

For example:

  • Favorite foods will never have a selection rating of less than 50%, up to 100%
  • Liked foods will have a range anywhere from 75% to 25%.
  • Disliked foods will have a rating of 25% percent or less.
  • Most disliked food will have a rating of 10% or less.
    (These numbers don’t actually work. See “Craving Rating Trials” below for more information.)

In practice:

#Eating affects mood differently:

In eating any food, the favorite will reflect more positively (++), the liked foods positively(+), the disliked foods neutrally (0), and the most-disliked food more negatively (–). Further, eating a favorite food could result in a journal entry about how tasty it was, and the most-disliked could result in something like “Ugh. Thought I’d try Golden Gourd again today. I still don’t like it.”

#Eating affects food craving:

Eating a food will result in that food’s craving rating dropping by 7%.
Every day, up to n+2 random foods will increase in value by a sum of (n+2)%.
This increase will be applied to foods even if it would normally put them over 100% but does not increase the craving rating above the maximum percentage for its category.
(These numbers also do not work. See "Craving Rating Trials below for more information.)

In practice:

Stephanie eats corn today. The result:

The next morning, her selection values are updated. Corn is increased by 1%, Turnip by 1%, Carrot by 2%, Pumpkin by 2%, and Golden_Gourd by 1%.
This doesn’t change much, because those values cannot be increased to more than their maximum:


Let’s watch as she eats for the next couple days.
Day 2: Ate Corn, then next day arrives. (Corn wasn’t chosen as a value to increase)

Day 3: Ate corn, then next day arrives. As you can see here, Stephanie will eat a Turnip or Carrot today instead of Corn.

#Craving Rating Trials
So, I ran these numbers through Excel, and they were bad. I mean REALLY bad. With the values I’d selected, it was less than 365 “days” before every value in the list went negative if not constrained. So… I tweaked them. And tweaked them. And tweaked them. And now I have values for only one instance. Six foods. And the results look like this:

As you can see, the favorite food, Corn Bread, is eaten only slightly more than three of the others. But the disliked food is eaten only occasionally and the most disliked food is eaten rarely. The results in this image show you the values calculated for each of 1000 meals/days.

What you can’t see in the image is that I no longer had a static (n+2)% increase randomly distributed throughout the foods. Instead, I went for a random float increase per day ranging from 0 to Increase Range Max (upper right of image).

But the real problem is that each number of foods in a Hearthling’s repertoire requires a specific set of values. The base Craving Rating is significantly different for five foods. I didn’t try seven foods, but I expect that, too, will be significantly different. I don’t know how to get these numbers without trial and error, and while I’m certainly willing to do the work to get them in… I wonder if someone with better math skills, particularly in statistics, could do better and maybe even present the problem with a more clearly defined algorithm.

I’m including a link to my Excel spreadsheet to show the work I’ve done getting as far as I have, and I leave it to brighter minds to simplify.

(Minor edit to reflect this Hearthling eats Corn Bread most, not Corn.)