Exemple #1
0
 public bool Equals(Strategy other)
 {
     return this._weights.Equals(other._weights);
 }
Exemple #2
0
 public Strategy Clone()
 {
     var clone = new Strategy
                 {
                     PowerAdjustParam = this.PowerAdjustParam,
                     MoneyAdjustParam = this.MoneyAdjustParam,
                     OilAdjustParam = this.OilAdjustParam,
                     ScoreAdjustParam = this.ScoreAdjustParam,
                     HomesAdjustParam = this.HomesAdjustParam,
                     EnvironmentAdjustParam = this.EnvironmentAdjustParam,
                 };
     this._weights.CopyTo(clone._weights);
     return clone;
 }
        void EmoteEnercitiesMessages.IEnercitiesAIPerceptions.UpdateStrategies(string StrategiesSet_strategies)
        {
            //TODO QUESTION what does this do?
            StrategiesSet ss = EmoteEvents.StrategiesSet.DeserializeFromJson(StrategiesSet_strategies);
            Dictionary<EmoteEnercitiesMessages.EnercitiesRole, double[]> strategies = ss.Strategies;
            foreach (KeyValuePair<EmoteEnercitiesMessages.EnercitiesRole, double[]> item in strategies)
            {
                //json = json + "\"" + item.Key + "\":\"" + item.Value + "\",";
                //double[] item.Value
                if(item.Key==EnercitiesRole.Mayor)
                {
                }
                else
                {

                     Strategy s = new Strategy(item.Value);
                    String player = RoleToPlayer[item.Key.ToString()];
                    int learnerId =  PlayerToId[player];
                //Weight -1 dont do, 1 is the pay attention. 
                //Abolute sum of all weights =1 
                //Scores/Strategy:
                double economy = s.EconomyWeight;
                double environment = s.EnvironmentWeight;
                double wellbeing = s.WellbeingWeight;
                double uniformity = s.ScoreUniformityWeight;

                //Resources:
                double homes = s.HomesWeight; //will tend to increase
                double money = s.MoneyWeight; //Will fluctuate with game? 
                double oil = s.OilWeight; //Will tend to decrease
                double power = s.PowerWeight; //Will fluctuate with game? 
              
                //check the item.key for the role, then check role to send the learner id to the system. Need to make a note based on the role sent in the start message.
                //break out each aspect of s and send to java.. 
                //Just send as evidence at the moment. 
                string[] eis = new string[8];
                EvidenceItem ei = new EvidenceItem(learnerId, stepId, activityId, scenarioId, 2,"economy",economy,EvidenceType.strategyWeight,sessionId);
                eis[0] = ei.SerializeToJson();
                ei = new EvidenceItem(learnerId, stepId, activityId, scenarioId, 2, "environment", environment, EvidenceType.strategyWeight, sessionId);
                eis[1] = ei.SerializeToJson();
                ei = new EvidenceItem(learnerId, stepId, activityId, scenarioId, 2, "wellbeing", wellbeing, EvidenceType.strategyWeight, sessionId);
                eis[2] = ei.SerializeToJson();
                ei = new EvidenceItem(learnerId, stepId, activityId, scenarioId, 2, "uniformity", uniformity, EvidenceType.strategyWeight, sessionId);
                eis[3] = ei.SerializeToJson();
                ei = new EvidenceItem(learnerId, stepId, activityId, scenarioId, 2, "homes", homes, EvidenceType.resourceWeight, sessionId);
                eis[4] = ei.SerializeToJson();
                ei = new EvidenceItem(learnerId, stepId, activityId, scenarioId, 2, "money", money, EvidenceType.resourceWeight, sessionId);
                eis[5] = ei.SerializeToJson();
                ei = new EvidenceItem(learnerId, stepId, activityId, scenarioId, 2, "oil", oil, EvidenceType.resourceWeight, sessionId);
                eis[6] = ei.SerializeToJson();
                ei = new EvidenceItem(learnerId, stepId, activityId, scenarioId, 2, "power", power, EvidenceType.resourceWeight, sessionId);
                eis[7] = ei.SerializeToJson();

                JavaWebRequest("addEvidenceItems", eis);

                }

                }
            //TODO QUESTION how should I record this? 
        }