Exemplo n.º 1
0
        public void Load(XElement element)
        {
            Plots       = Convert.ToInt32(element.Element("plots").Value);
            TravelTime  = Convert.ToDouble(element.Element("travelTime").Value);
            FoodRate    = Convert.ToInt32(element.Element("foodRate").Value);
            GameSeconds = Convert.ToInt32(element.Element("gameSeconds").Value);

            PlotProbabilities.Clear();
            ProbabilityShiftTimes.Clear();

            var plotProbabilitiesElement = element.Element("plot-probabilities");

            if (plotProbabilitiesElement != null)
            {
                foreach (var probabilitySetElement in plotProbabilitiesElement.Elements("probability-set"))
                {
                    PlotProbabilities.Add(CLIObject.FromArrayString <int>(probabilitySetElement.Value).ToList());
                }
            }

            var probabilityShiftTimesElement = element.Element("probability-shift-times");

            if (probabilityShiftTimesElement != null)
            {
                ProbabilityShiftTimes.AddRange(CLIObject.FromArrayString <int>(probabilityShiftTimesElement.Value));
            }
        }
Exemplo n.º 2
0
        public IDictionary <string, string> GetArguments()
        {
            var arguments = new Dictionary <string, string>();

            arguments["plots"]                   = Plots.ToString();
            arguments["travel-time"]             = TravelTime.ToString();
            arguments["food-rate"]               = FoodRate.ToString();
            arguments["game-duration"]           = GameSeconds.ToString();
            arguments["plot-probabilities"]      = CLIObject.ToMultiArrayString(PlotProbabilities.Cast <IEnumerable <int> >());
            arguments["probability-shift-times"] = CLIObject.ToArrayString(ProbabilityShiftTimes);

            return(arguments);
        }