public void SetTodaysWeather() { string[] forecastSplit = predictedForecast.Split(); string cond = ""; for (int i = 0; i < forecastSplit.Length - 1; i++) { cond += forecastSplit[i]; if (i != forecastSplit.Length - 2) { cond += " "; } } if (MyRandom.Next(10) < 2) { condition = GetRandomWeatherCondition(); temperature = RandomTemperature(condition); } else { condition = cond; temperature = MyRandom.Next(-5, 6) + Int32.Parse(forecastSplit[forecastSplit.Length - 1]); } SetBuyChance(); }
private int Brain(int input) { int thoughts; thoughts = MyRandom.Next(input - 1, input + 1); return(thoughts); }
public int DetermineRealNumberOfCustomers() { string[] splitForecast = predictedForecast.Split(); int numCustomers = Int32.Parse(splitForecast[splitForecast.Length - 1]); int upper = numCustomers / 2; int lower = upper - (2 * upper); return(numCustomers + MyRandom.Next(lower, upper + 1)); }
private double Brain(double input) { double thoughts; thoughts = MyRandom.Next((Convert.ToInt32(input * 100) + 5) - (Convert.ToInt32(input * 100) - 5)); thoughts /= 100; return(thoughts); }
public bool CheckIfBuy(Weather weather, Recipe recipe) { bool willBuy = false; double averageBuyChance = (weather.buyChance + recipe.buyChance + buyChance) / 3; if (MyRandom.Next(1, 101) < averageBuyChance) { willBuy = true; } return(willBuy); }
public int RandomTemperature(string currentCondition) { int temp = 0; switch (currentCondition) { case ("Sunny"): temp = MyRandom.Next(75, 96); break; case ("Cloudy"): temp = MyRandom.Next(65, 75); break; case ("Rainy"): temp = MyRandom.Next(50, 65); break; case ("Stormy"): temp = MyRandom.Next(45, 61); break; case ("Snowing"): temp = MyRandom.Next(0, 33); break; case ("Windy"): temp = MyRandom.Next(40, 75); break; case ("Icy"): temp = MyRandom.Next(-10, 21); break; default: break; } return(temp); }
public string GetRandomWeatherCondition() { return(weatherConditions[MyRandom.Next(0, weatherConditions.Count)]); }
public void SetRealWeatherForcast() { predictedForecast = condition + " " + (temperature + MyRandom.Next(-10, 11)); }
public void SetBuyChance() { buyChance = MyRandom.Next(30, 75); }