Exemplo n.º 1
0
        public double RetrieveOdds(MersenneTwister dice, string weather, int day, bool EnforceHigherOverLower = true)
        {
            double Odd = 0;

            List <WeatherParameters> wp = this.WeatherChances.Where(w => w.WeatherType == weather).ToList();

            if (wp.Count == 0)
            {
                return(0);
            }

            Odd = wp[0].BaseValue + (wp[0].ChangeRate * day);
            RangePair range = new RangePair(wp[0].VariableLowerBound, wp[0].VariableHigherBound, EnforceHigherOverLower);

            Odd += range.RollInRange(dice);

            //sanity check.
            if (Odd < 0)
            {
                Odd = 0;
            }
            if (Odd > 1)
            {
                Odd = 1;
            }

            return(Odd);
        }
Exemplo n.º 2
0
        public double RetrieveOdds(MersenneTwister dice, string weather, int day, StringBuilder Output)
        {
            double Odd = 0;

            List <WeatherParameters> wp = this.WeatherChances.Where(w => w.WeatherType == weather).ToList <WeatherParameters>();

            if (wp.Count == 0)
            {
                Output.Append($"{weather} weather is not found in this time span.");
                return(0);
            }

            Output.Append($"Retrieved data for {weather} on {day} with Base Value {wp[0].BaseValue} and Change Rate {wp[0].ChangeRate} " +
                          $"with the variable bound of ({wp[0].VariableLowerBound} , {wp[0].VariableHigherBound}) {Environment.NewLine}");

            Odd = wp[0].BaseValue + (wp[0].ChangeRate * day);
            RangePair range = new RangePair(wp[0].VariableLowerBound, wp[0].VariableHigherBound);

            Odd = Odd + range.RollInRange(dice);

            //sanity check.
            if (Odd < 0)
            {
                Odd = 0;
            }
            if (Odd > 1)
            {
                Odd = 1;
            }

            return(Odd);
        }
Exemplo n.º 3
0
        public double RetrieveTemp(MersenneTwister dice, string temp, int day, bool EnforceHigherOverLower = true)
        {
            double Temp = 0;
            List <WeatherParameters> wp = this.WeatherChances.Where(w => w.WeatherType == temp).ToList <WeatherParameters>();

            if (wp.Count == 0)
            {
                return(0);
            }

            Temp = wp[0].BaseValue + (wp[0].ChangeRate * day);
            RangePair range = new RangePair(wp[0].VariableLowerBound, wp[0].VariableHigherBound, EnforceHigherOverLower);

            Temp += range.RollInRange(dice);

            return(Temp);
        }
Exemplo n.º 4
0
        public double RetrieveTemp(MersenneTwister dice, string temp, int day, StringBuilder Output)
        {
            double Temp = 0;
            List <WeatherParameters> wp = this.WeatherChances.Where(w => w.WeatherType == temp).ToList <WeatherParameters>();

            if (wp.Count == 0)
            {
                Output.Append($"{temp} weather is not found in this time span.");
                return(0);
            }

            Output.Append($"Retrieved data for {temp} on {day} with Base Value {wp[0].BaseValue} and Change Rate {wp[0].ChangeRate} " +
                          $"with the variable bound of ({wp[0].VariableLowerBound} , {wp[0].VariableHigherBound}) {Environment.NewLine}");

            Temp = wp[0].BaseValue + (wp[0].ChangeRate * day);
            RangePair range = new RangePair(wp[0].VariableLowerBound, wp[0].VariableHigherBound);

            Temp = Temp + range.RollInRange(dice);

            return(Temp);
        }