Beispiel #1
0
        /// <summary>
        /// Storing the hole state of the agent
        /// </summary>
        /// <param name="argAgentToStore">agent to store</param>
        public void StoreAgent(Agent argAgentToStore)
        {
            StoredInformation st = new StoredInformation();  //Information to store, includes the agent

            st.StoredInfo = argAgentToStore;

            if (StoredAgents.ContainsKey(argAgentToStore))
            {
                StoredAgents[argAgentToStore].Clear();
                StoredAgents[argAgentToStore].Add(st);
            }
            else
            {
                List <StoredInformation> lst = new List <StoredInformation>();
                lst.Add(st);
                StoredAgents.Add(argAgentToStore, lst);
            }
        }
Beispiel #2
0
        }                                                                                            //Dictionary with memories about other agents: <reference to the agent(id), info about agent>.

        #endregion

        public void StoreAction(Agent argAgentSender, ActionAbstract argAction)
        {
            StoredInformation st = new StoredInformation();   //New information to store

            st.StoredInfo = argAction.CharacteristicsOfSubject();

            if (StoredAgents.ContainsKey(argAgentSender))
            {
                if (!(StoredAgents[argAgentSender].Exists(obj =>
                {
                    return(obj.StoredInfo == argAction.CharacteristicsOfSubject());
                })))
                {
                    StoredAgents[argAgentSender].Add(st);
                }
            }
            else
            {
                List <StoredInformation> lst = new List <StoredInformation>();  //New list to store new agent
                lst.Add(st);
                StoredAgents.Add(argAgentSender, lst);
            }
        }