This wiki is a read-only version of the Stardew Valley Wiki. The official editable wiki maintained by ConcernedApe can be found at stardewvalleywiki.com

Talk:Silo

From Stardew Valley Wiki
Jump to: navigation, search
This talk page is for discussing Silo.
  • Sign and date your posts by typing four tildes (~~~~).
  • Put new text below old text.
  • Be polite.
  • Assume good faith.
  • Don't delete discussions.

Code math

The source code for whether grass gets turned into hay for the silo appears to be the following:

Random random2 = Game1.IsMultiplayer ? Game1.recentMultiplayerRandom : new Random((int)(Game1.uniqueIDForThisGame + tileLocation.X * 1000f + tileLocation.Y * 11f));
  if (random2.NextDouble() < 0.5 && (Game1.getLocationFromName("Farm") as Farm).tryToAddHay(1) == 0)

Which, from what I can tell, generates a random number based on the current date (uniqueIDForThisGame is uniqueIDForThisGame = (ulong)(DateTime.UtcNow - new DateTime(2012, 6, 22)).TotalSeconds;) and current tile location, then checks if that number is less than 0.5. Basically, this means that I don't think I can work out an actual probability per grass, but thought I'd put this here anyway. Samwalton9 (talk) 03:56, 29 April 2016 (EDT)

On second thoughts, this presumably means that there's a 50% chance, since the random number generator probably generates equally between 0 and 1, then it's checked as below 0.5. Should probably test this first though. Samwalton9 (talk) 05:28, 29 April 2016 (EDT)
From reading the C# Random documentation, it seems this is indeed the case; 50% chance to get hay. Samwalton9 (talk) 05:41, 29 April 2016 (EDT)
Just to waffle about this some more since I think I've figured it out - I think the random number generator is based on time (in seconds) and grass position because otherwise you would get all or nothing per sweep of grass; using the position too makes it random per tile of grass. Samwalton9 (talk) 05:51, 29 April 2016 (EDT)