public override void ApplyEffects(ref WorldDynamic state)
        {
            KeyValuePair <AgentStateStatic, AgentStateDynamic> stateAgent      = state.GetAgentByName(Agent.Key.GetName());
            KeyValuePair <AgentStateStatic, AgentStateDynamic> stateAgentClone = state.GetLocationByName(Location.Key.GetName()).Value.GetAgent(Agent);
            KeyValuePair <AgentStateStatic, AgentStateDynamic> stateKiller     = state.GetAgentByName(Killer.Key.GetName());
            KeyValuePair <LocationStatic, LocationDynamic>     stateLocation   = state.GetLocationByName(Location.Key.GetName());

            stateAgent.Value.ClearTempStates();
            stateKiller.Value.ClearTempStates();

            stateAgent.Value.AddEvidence(stateKiller.Key);
            stateAgent.Value.GetBeliefs().GetAgentByName(stateKiller.Key.GetName()).AssignRole(AgentRole.KILLER);
            stateAgent.Value.SetObjectOfAngry(stateKiller.Key);
            stateAgent.Value.AddExploredLocation(stateLocation.Key);
        }
        public override void ApplyEffects(ref WorldDynamic state)
        {
            KeyValuePair <AgentStateStatic, AgentStateDynamic> stateAgent    = state.GetAgentByName(Agent.Key.GetName());
            KeyValuePair <LocationStatic, LocationDynamic>     stateLocation = state.GetLocationByName(Location.Key.GetName());

            stateAgent.Value.SetTargetLocation(stateLocation.Key);
        }
        public override void ApplyEffects(ref WorldDynamic state)
        {
            KeyValuePair <LocationStatic, LocationDynamic>     stateFrom  = state.GetLocationByName(From.Key.GetName());
            KeyValuePair <LocationStatic, LocationDynamic>     stateTo    = state.GetLocationByName(To.Key.GetName());
            KeyValuePair <AgentStateStatic, AgentStateDynamic> stateAgent = state.GetAgentByName(Agent.Key.GetName());

            stateAgent.Value.ClearTempStates();

            stateFrom.Value.RemoveAgent(Agent);
            stateAgent.Value.GetBeliefs().GetAgentByName(stateAgent.Key.GetName()).ClearLocation();

            stateTo.Value.AddAgent(Agent);
            stateAgent.Value.GetBeliefs().GetAgentByName(stateAgent.Key.GetName()).SetLocation(stateTo.Key);

            if (stateTo.Key == stateAgent.Value.GetTargetLocation())
            {
                stateAgent.Value.ClearTargetLocation();
            }
        }
Esempio n. 4
0
        /// <summary>
        /// Updates the agent's beliefs about the location where he is.
        /// </summary>
        public void RefreshBeliefsAboutTheWorld(WorldDynamic currentWorldState, KeyValuePair <AgentStateStatic, AgentStateDynamic> agent)
        {
            // Before clearing the information, remember the location in which the agent is located.
            //LocationStatic agentIsHereLoc = agent.Value.GetBeliefs().SearchAgentAmongLocations(agent.Key);
            LocationStatic agentIsHereLoc = currentWorldState.GetLocationByName(currentWorldState.SearchAgentAmongLocations(agent.Key).GetName()).Key;

            // We clear the information about the location in which the agent is located, in his beliefs.
            agent.Value.GetBeliefs().GetAgentByName(agent.Key.GetName()).ClearLocation();

            // We find the same location in the "real" world. We go through the agents in it. We are looking for agents
            //    with the same names in the agent's beliefs. We add them to the location (in his beliefs) where he (in his belief) is.
            foreach (var agent1 in currentWorldState.GetLocationByName(agentIsHereLoc.GetName()).Value.GetAgents())
            {
                foreach (var agent2 in agent.Value.GetBeliefs().GetAgentsInWorld())
                {
                    if (agent1.Key.GetName() == agent2.GetInfo().GetName())
                    {
                        agent.Value.GetBeliefs().GetAgentByName(agent2.GetInfo().GetName()).SetLocation(agentIsHereLoc);

                        if (!agent2.CheckStatus())
                        {
                            foreach (var a in currentWorldState.GetAgents())
                            {
                                a.Value.GetBeliefs().GetAgentByName(agent2.GetInfo().GetName()).Dead();
                            }
                        }

                        break;
                    }
                }
            }

            foreach (var agent1 in agent.Value.GetBeliefs().GetAgentsInWorld())
            {
                if (agent1.GetLocation().GetName() == agentIsHereLoc.GetName() &&
                    currentWorldState.GetAgentByName(agent1.GetInfo().GetName()).Value.GetMyLocation().GetName() != agentIsHereLoc.GetName() &&
                    agent.Key.GetName() != agent1.GetInfo().GetName())
                {
                    agent1.SetLocation(currentWorldState.GetLocationByName(agentIsHereLoc.GetName()).Key.GetRandomConnectedLocation());
                }
            }
        }
        public override void ApplyEffects(ref WorldDynamic state)
        {
            KeyValuePair <AgentStateStatic, AgentStateDynamic> stateAgent     = state.GetAgentByName(Agent.Key.GetName());
            KeyValuePair <AgentStateStatic, AgentStateDynamic> stateKiller    = state.GetAgentByName(Killer.Key.GetName());
            KeyValuePair <LocationStatic, LocationDynamic>     stateLocation2 = state.GetLocationByName(Location2.Key.GetName());

            stateAgent.Value.ClearTempStates();
            stateKiller.Value.ClearTempStates();

            stateAgent.Value.SetTargetLocation(stateLocation2.Key);

            stateAgent.Value.DecreaseTimeToMove();
        }
Esempio n. 6
0
        public override void ApplyEffects(ref WorldDynamic state)
        {
            KeyValuePair <AgentStateStatic, AgentStateDynamic> stateAgent  = state.GetAgentByName(Agent.Key.GetName());
            KeyValuePair <AgentStateStatic, AgentStateDynamic> stateKiller = state.GetAgentByName(Killer.Key.GetName());

            stateAgent.Value.ClearTempStates();
            stateKiller.Value.ClearTempStates();

            stateAgent.Value.SetStatus(false);
            stateAgent.Value.GetBeliefs().GetAgentByName(stateAgent.Key.GetName()).Dead();
            stateKiller.Value.GetBeliefs().GetAgentByName(stateAgent.Key.GetName()).Dead();

            state.GetLocationByName(state.SearchAgentAmongLocations(stateAgent.Key).GetName()).Value.GetAgent(stateAgent).Value.Die();
        }
Esempio n. 7
0
        public List<PlanAction> MassiveAssignVariables(ref PlanAction action, 
                                           WorldDynamic currentState, 
                                           KeyValuePair<AgentStateStatic, AgentStateDynamic> initiator)
        {
            List<PlanAction> actions = new List<PlanAction>();

            if (action is Move)
            {
                int locationsCount = 
                    currentState.GetLocationByName(currentState.SearchAgentAmongLocations(initiator.Key).GetName()).Key.GetConnectedLocations().Count;

                List<Move> moveArr = new List<Move>();

                for (int i = 0; i < locationsCount; i++)
                {
                    Move move = new Move();
                    moveArr.Add(move);
                }

                for (int i = 0; i < locationsCount; i++)
                {
                    moveArr[i].Arguments.Add(initiator);
                    moveArr[i].Arguments.Add(currentState.GetLocationByName(currentState.SearchAgentAmongLocations(initiator.Key).GetName()));
                    moveArr[i].Arguments.Add(currentState.GetLocationByName
                        (currentState.GetLocationByName(
                            currentState.SearchAgentAmongLocations(initiator.Key).GetName()).Key.GetConnectedLocationsFromIndex(i).GetName()));
                }

                foreach (var a in moveArr)
                {
                    actions.Add(a);
                }
            }

            return actions;
        }
        /// <summary>
        /// This method creates a separate agent using the information passed to it.
        /// Then it places the agent on the environment and passes information about it to it.
        /// </summary>
        public void CreateAgent(string name, bool status, AgentRole role, Goal goals, WorldContext beliefs, string spawnLocationName)
        {
            // We clone locations from the world.
            Dictionary <LocationStatic, LocationDynamic> locations = currentStoryState.CloneLocations();

            // We construct a new agent, from static and dynamic parts.
            AgentStateStatic  newAgentStateStatic  = new AgentStateStatic(name, role);
            AgentStateDynamic newAgentStateDynamic = new AgentStateDynamic(status, goals, beliefs, newAgentStateStatic);
            KeyValuePair <AgentStateStatic, AgentStateDynamic> newAgent =
                new KeyValuePair <AgentStateStatic, AgentStateDynamic>(newAgentStateStatic, newAgentStateDynamic);

            // Add the agent to the list of agents.
            currentStoryState.AddAgent(newAgent, currentStoryState.GetLocationByName(spawnLocationName));

            // We transfer information about the locations in the world to the agent.
            newAgent.Value.GetBeliefs().SetLocationsInWorld(locations);

            // We inform the agent in which location it was created.
            newAgent.Value.GetBeliefs().SetMyLocation(newAgent.Value.GetBeliefs().GetLocationByName(spawnLocationName));
            newAgent.Value.GetBeliefs().AddAgentInBeliefs(newAgent, newAgent.Key.GetRole());
            newAgent.Value.GetBeliefs().GetAgentByName(newAgent.Key.GetName()).
            SetLocation(newAgent.Value.GetBeliefs().GetLocationByName(spawnLocationName));
        }
Esempio n. 9
0
        /// <summary>
        /// Generate a new PDDL file with a problem for the specified agent, based on his beliefs.
        /// </summary>
        public void GenerateNewPDDLProblem(KeyValuePair <AgentStateStatic, AgentStateDynamic> agent,
                                           WorldDynamic currentWorldState,
                                           bool killerCantCreatePlan = false)
        {
            string fileName    = "";
            string problemName = "";
            string domainName  = "";
            string objects     = "";
            string init        = "";
            string goal        = "";

            switch (agent.Key.GetRole())
            {
            case AgentRole.USUAL:
                fileName = "AgentProblemTEST";
                break;

            case AgentRole.KILLER:
                fileName = "KillerProblemTEST";
                break;

            case AgentRole.PLAYER:
                fileName = "PlayerProblemTEST";
                break;
            }

            problemName = "detective-problem";
            domainName  = "detective-domain";

            foreach (var location in agent.Value.GetBeliefs().GetLocationsInWorld())
            {
                objects = objects.Insert(objects.Length, location.GetName() + " ");
                init    = init.Insert(init.Length, Environment.NewLine + "(ROOM " + location.GetName() + ") ");

                foreach (var connectedLocation in location.GetConnectedLocations())
                {
                    init = init.Insert(init.Length, "(connected " + location.GetName() + " " + connectedLocation.GetName() + ")");
                }
            }

            foreach (var a in agent.Value.GetBeliefs().GetAgentsInWorld())
            {
                objects = objects.Insert(objects.Length, a.GetInfo().GetName() + " ");

                switch (a.GetRole())
                {
                case AgentRole.USUAL:
                    init = init.Insert(init.Length, Environment.NewLine + "(AGENT " + a.GetInfo().GetName() + ") ");
                    break;

                case AgentRole.KILLER:
                    init = init.Insert(init.Length, Environment.NewLine + "(KILLER " + a.GetInfo().GetName() + ") ");
                    break;

                case AgentRole.PLAYER:
                    if (agent.Key.GetRole() == AgentRole.PLAYER)
                    {
                        init = init.Insert(init.Length, Environment.NewLine + "(PLAYER " + a.GetInfo().GetName() + ") ");
                    }
                    else
                    {
                        init = init.Insert(init.Length, Environment.NewLine + "(AGENT " + a.GetInfo().GetName() + ") ");
                    }
                    break;
                }

                switch (a.CheckStatus())
                {
                case true:
                    init = init.Insert(init.Length, "(alive " + a.GetInfo().GetName() + ") ");
                    break;

                case false:
                    init = init.Insert(init.Length, "(died " + a.GetInfo().GetName() + ") ");
                    break;
                }

                switch (agent.Key.GetRole())
                {
                case AgentRole.USUAL:
                    // An agent can claim that some other agent is in a certain location only if he has this information.
                    if (agent.Value.GetBeliefs().SearchAgentAmongLocations(a.GetInfo()) != null)
                    {
                        init = init.Insert(init.Length, "(in-room " + a.GetInfo().GetName() + " " +
                                           agent.Value.GetBeliefs().GetLocationByName(agent.Value.GetBeliefs().SearchAgentAmongLocations(a.GetInfo()).GetName())
                                           .GetName() + ") ");

                        if (agent.Key.GetName() == a.GetInfo().GetName())
                        {
                            foreach (var loc in agent.Value.GetExploredLocations())
                            {
                                init = init.Insert(init.Length, "(explored-room " + a.GetInfo().GetName() + " " + loc.GetName() + ")");
                            }

                            if (agent.Value.GetObjectOfAngry() != null && agent.Value.AngryCheck())
                            {
                                init = init.Insert(init.Length, "(angry-at " + agent.Key.GetName() + " " + agent.Value.GetObjectOfAngry().GetObjectOfAngry().GetName() + ")");
                            }
                        }
                    }
                    break;

                case AgentRole.KILLER:
                    init = init.Insert(init.Length, "(in-room " + a.GetInfo().GetName() + " " +
                                       agent.Value.GetBeliefs().GetLocationByName(currentWorldState.SearchAgentAmongLocations(a.GetInfo()).GetName())
                                       .GetName() + ") ");
                    break;

                case AgentRole.PLAYER:
                    init = init.Insert(init.Length, "(in-room " + a.GetInfo().GetName() + " " +
                                       agent.Value.GetBeliefs().GetLocationByName(currentWorldState.SearchAgentAmongLocations(a.GetInfo()).GetName())
                                       .GetName() + ") ");
                    break;
                }
            }

            if (agent.Value.GetGoal().goalTypeIsStatus)
            {
                switch (agent.Key.GetRole())
                {
                case AgentRole.USUAL:
                    foreach (var a in agent.Value.GetGoal().GetGoalState().GetAgents())
                    {
                        if (a.Key.GetRole() == AgentRole.KILLER)
                        {
                            if (a.Key.GetName() != null && a.Key.GetName() != "" && a.Key.GetName() != "???")
                            {
                                goal = goal.Insert(goal.Length, "(died " + a.Key.GetName() + ") ");
                            }
                            else if (agent.Value.GetObjectOfAngry() != null && agent.Value.AngryCheck())
                            {
                                goal = goal.Insert(goal.Length, "(died " + agent.Value.GetObjectOfAngry().GetObjectOfAngry().GetName() + ") ");
                            }
                            else
                            {
                                if (currentWorldState.GetLocationByName(agent.Value.GetBeliefs().GetMyLocation().GetName()).
                                    Value.CountAliveAgents() >= 2)
                                {
                                    goal = goal.Insert(goal.Length, "(talking " + agent.Key.GetName() + " "
                                                       + currentWorldState.GetRandomAgentInMyLocation(agent).Key.GetName() + ") ");
                                }
                                else if (!CheckIfLocationIsExplored(agent.Value.GetMyLocation()))
                                {
                                    goal = goal.Insert(goal.Length, "(explored-room " + agent.Key.GetName() + " "
                                                       + agent.Value.GetMyLocation().GetName() + ") ");
                                }
                                else
                                {
                                    if (timeToMove == 0)
                                    {
                                        if (agent.Value.GetTargetLocation() != null)
                                        {
                                            goal = goal.Insert(goal.Length, "(in-room " + agent.Key.GetName() + " "
                                                               + agent.Value.GetTargetLocation().GetName() + ") ");
                                        }
                                        else
                                        {
                                            agent.Value.SetTargetLocation(
                                                currentWorldState.GetRandomLocationWithout(
                                                    currentWorldState.GetLocationByName(
                                                        agent.Value.GetBeliefs().GetMyLocation().GetName())).Key);

                                            goal = goal.Insert(goal.Length, "(in-room " + agent.Key.GetName() + " "
                                                               + agent.Value.GetTargetLocation().GetName() + ") ");
                                        }
                                    }
                                    else
                                    {
                                        goal = goal.Insert(goal.Length, "(wait" + agent.Key.GetName() + " " + ") ");
                                    }
                                }
                            }
                        }
                    }
                    break;

                case AgentRole.PLAYER:
                    foreach (var a in agent.Value.GetGoal().GetGoalState().GetAgents())
                    {
                        if (a.Key.GetRole() == AgentRole.KILLER)
                        {
                            if (a.Key.GetName() != null && a.Key.GetName() != "???" && a.Key.GetName() != "" &&
                                agent.Value.GetBeliefs().GetMyLocation().GetName() != currentWorldState.SearchAgentAmongLocationsByName(agent.Value.GetObjectOfAngry().GetObjectOfAngry().GetName()).GetName())
                            {
                                goal = goal.Insert(goal.Length, "(died " + a.Key.GetName() + ") ");
                            }
                            else if (agent.Value.GetObjectOfAngry() != null && agent.Value.AngryCheck() &&
                                     agent.Value.GetBeliefs().GetMyLocation().GetName() != currentWorldState.SearchAgentAmongLocationsByName(agent.Value.GetObjectOfAngry().GetObjectOfAngry().GetName()).GetName())
                            {
                                goal = goal.Insert(goal.Length, "(died " + agent.Value.GetObjectOfAngry().GetObjectOfAngry().GetName() + ") ");
                            }
                            else
                            {
                                if (currentWorldState.GetLocationByName(agent.Value.GetBeliefs().GetMyLocation().GetName()).Value.GetAgents().Count >= 2)
                                {
                                    goal = goal.Insert(goal.Length, "(talking " + agent.Key.GetName() + " "
                                                       + currentWorldState.GetRandomAgent(agent).Key.GetName() + ") ");
                                }
                                else if (!CheckIfLocationIsExplored(agent.Value.GetMyLocation()))
                                {
                                    goal = goal.Insert(goal.Length, "(explored-room " + agent.Key.GetName() + " "
                                                       + agent.Value.GetMyLocation().GetName() + ") ");
                                }
                                else
                                {
                                    if (agent.Value.GetTargetLocation() != null)
                                    {
                                        goal = goal.Insert(goal.Length, "(in-room " + agent.Key.GetName() + " "
                                                           + agent.Value.GetTargetLocation().GetName() + ") ");
                                    }
                                    else
                                    {
                                        agent.Value.SetTargetLocation(
                                            currentWorldState.GetRandomLocationWithout(
                                                currentWorldState.GetLocationByName(
                                                    agent.Value.GetBeliefs().GetMyLocation().GetName())).Key);

                                        goal = goal.Insert(goal.Length, "(in-room " + agent.Key.GetName() + " "
                                                           + agent.Value.GetTargetLocation().GetName() + ") ");
                                    }
                                }
                            }
                        }
                    }
                    break;

                case AgentRole.KILLER:

                    if (currentWorldState.GetLocationByName(agent.Value.GetBeliefs().GetMyLocation().GetName()).Value.CountAliveAgents() == 2)
                    {
                        foreach (var a in currentWorldState.GetLocationByName(agent.Value.GetBeliefs().GetMyLocation().GetName()).Value.GetAgents())
                        {
                            if (a.Value.GetStatus() && (a.Key.GetRole() == AgentRole.USUAL || a.Key.GetRole() == AgentRole.PLAYER))
                            {
                                goal = goal.Insert(goal.Length, "(died " + a.Key.GetName() + ") ");
                            }
                        }
                    }
                    else if (currentWorldState.GetLocationByName(agent.Value.GetBeliefs().GetMyLocation().GetName()).Value.CountAliveAgents() == 1)
                    {
                        goal = goal.Insert(goal.Length, "(in-room " + currentWorldState.GetRandomAgent(agent).Key.GetName() + " "
                                           + currentWorldState.GetLocationByName(agent.Value.GetMyLocation().GetName()).Key.GetName()
                                           + ") ");
                    }
                    else
                    {
                        if (timeToMove == 0)
                        {
                            goal = goal.Insert(goal.Length, "(in-room " + agent.Key.GetName() + " "
                                               + currentWorldState.GetRandomConnectedLocation(currentWorldState.GetLocationByName(agent.Value.GetMyLocation().GetName())).Key.GetName()
                                               + ") ");
                        }
                        else
                        {
                            goal = goal.Insert(goal.Length, "(wait " + agent.Key.GetName() + " " + ") ");
                        }
                    }

                    /*killerCantCreatePlan = true;
                     * if (killerCantCreatePlan)
                     * {
                     *  if (currentWorldState.GetLocationByName(agent.Value.GetBeliefs().GetMyLocation().GetName()).Value.CountAliveAgents() > 2
                     *      && timeToMove == 0)
                     *  {
                     *      goal = goal.Insert(goal.Length, "(in-room " + agent.Key.GetName() + " "
                     + currentWorldState.GetRandomConnectedLocation(currentWorldState.GetLocationByName(agent.Value.GetMyLocation().GetName())).Key.GetName()
                     + ") ");
                     +  }
                     +  else if (timeToMove > 0)
                     +  {
                     +
                     +  }
                     +  else
                     +  {
                     +      bool hasTarget = false;
                     +
                     +      while (!hasTarget)
                     +      {
                     +          BeliefsAboutAgent a = null;
                     +
                     +          foreach (var agnt in agent.Value.GetBeliefs().GetAgentsInWorld())
                     +          {
                     +              if (agnt.CheckStatus() && (agnt.GetRole() == AgentRole.USUAL || agnt.GetRole() == AgentRole.PLAYER))
                     +              {
                     +                  a = agnt;
                     +                  break;
                     +              }
                     +          }
                     +
                     +          if (a.GetInfo().GetRole() == AgentRole.USUAL || a.GetInfo().GetRole() == AgentRole.PLAYER)
                     +          {
                     +              goal = goal.Insert(goal.Length, "(died " + a.GetInfo().GetName() + ") ");
                     +              hasTarget = true;
                     +          }
                     +      }
                     +  }
                     + }*/
                    break;
                }
            }


            FileStream   file         = new FileStream(fileName + ".pddl", FileMode.Create, FileAccess.ReadWrite);
            StreamWriter streamWriter = new StreamWriter(file, Encoding.GetEncoding(1251));

            streamWriter.WriteLine("(define (problem " + problemName + ")");
            streamWriter.WriteLine("(:domain " + domainName + ")");
            streamWriter.WriteLine("(:objects " + objects + ")");
            streamWriter.WriteLine("(:init " + init + ")");
            streamWriter.WriteLine("(:goal (and " + goal + "))");
            streamWriter.WriteLine(")");

            streamWriter.Close();
        }
Esempio n. 10
0
        public bool AssignVariables(ref PlanAction action, WorldDynamic currentState, KeyValuePair<AgentStateStatic, AgentStateDynamic> initiator)
        {
            if (action is Entrap || action is CounterEntrap)
            {
                foreach (var agent in currentState.GetAgents())
                {
                    if ((agent.Key.GetRole() == AgentRole.USUAL || agent.Key.GetRole() == AgentRole.PLAYER) && agent.Value.GetStatus() 
                        && !currentState.GetLocation(currentState.SearchAgentAmongLocations(agent.Key)).Value.SearchAgent(initiator.Key) 
                        && !agent.Equals(initiator))
                    {
                        action.Arguments.Add(agent);
                        action.Arguments.Add(initiator); 
                        action.Arguments.Add(currentState.GetLocationByName(currentState.SearchAgentAmongLocations(initiator.Key).GetName()));
                        return true;
                    }
                }
                return false;
            }
            else if (action is Fight || action is CounterFight)
            {
                foreach (var agent in currentState.GetAgents())
                {
                    if ((agent.Key.GetRole() == AgentRole.USUAL || agent.Key.GetRole() == AgentRole.PLAYER) && agent.Value.GetStatus() 
                        && currentState.GetLocation(currentState.SearchAgentAmongLocations(initiator.Key)).Value.SearchAgent(agent.Key))
                    {
                        action.Arguments.Add(initiator);
                        action.Arguments.Add(agent);
                        action.Arguments.Add(currentState.GetLocation(currentState.SearchAgentAmongLocations(initiator.Key)));
                        return true;
                    }
                }
                return false;
            }
            else if (action is InvestigateRoom || action is CounterInvestigateRoom)
            {
                foreach (var killer in currentState.GetAgents())
                {
                    if (killer.Key.GetRole() == AgentRole.KILLER && killer.Value.GetStatus())
                    {
                        action.Arguments.Add(initiator);
                        action.Arguments.Add(killer);
                        action.Arguments.Add(currentState.GetLocationByName(currentState.SearchAgentAmongLocations(initiator.Key).GetName()));
                        return true;
                    }
                }
                return false;
            }
            else if (action is Kill || action is CounterKill)
            {
                foreach (var agent in currentState.GetAgents())
                {
                    if ((agent.Key.GetRole() == AgentRole.USUAL || agent.Key.GetRole() == AgentRole.PLAYER) && agent.Value.GetStatus() 
                        && currentState.GetLocation(currentState.SearchAgentAmongLocations(initiator.Key)).Value.SearchAgent(agent.Key))
                    {
                        action.Arguments.Add(agent);
                        action.Arguments.Add(initiator);
                        action.Arguments.Add(currentState.GetLocation(currentState.SearchAgentAmongLocations(initiator.Key)));
                        return true;
                    }
                }
                return false;
            }
            else if (action is Move || action is CounterMove)
            {
                if (action.Arguments.Count() != 0)
                {
                    List<string> arguments = new List<string>();

                    foreach (var argument in action.Arguments)
                    {
                        arguments.Add((string)argument);
                    }

                    action.Arguments.Clear();

                    action.Arguments.Add(initiator);
                    action.Arguments.Add(currentState.GetLocationByName(arguments[1]));
                    action.Arguments.Add(currentState.GetLocationByName(arguments[2]));
                    return true;
                }
                else
                {
                    action.Arguments.Add(initiator);
                    action.Arguments.Add(currentState.GetLocationByName(currentState.SearchAgentAmongLocations(initiator.Key).GetName()));

                    if (initiator.Value.GetTargetLocation() != null && initiator.Key.GetRole() != AgentRole.PLAYER &&
                        currentState.SearchAgentAmongLocations(initiator.Key).ConnectionChecking(initiator.Value.GetTargetLocation()))
                    {
                        action.Arguments.Add(currentState.GetLocationByName(initiator.Value.GetTargetLocation().GetName()));
                        return true;
                    }
                    else
                    {
                        KeyValuePair<LocationStatic, LocationDynamic> randLoc = currentState.
                          GetRandomConnectedLocation(currentState.GetLocationByName(currentState.SearchAgentAmongLocations(initiator.Key).GetName()));

                        if (currentState.GetLocationByName(currentState.SearchAgentAmongLocations(initiator.Key).GetName()).
                            Key.ConnectionChecking(randLoc.Key))
                        {
                            action.Arguments.Add(randLoc);
                            return true;
                        }
                    }
                }
                return false;
            }
            else if (action is NeutralizeKiller || action is CounterNeutralizeKiller)
            {
                foreach (var killer in currentState.GetAgents())
                {
                    if (killer.Key.GetRole() == AgentRole.KILLER && killer.Value.GetStatus())
                    {
                        action.Arguments.Add(initiator);
                        action.Arguments.Add(killer);
                        action.Arguments.Add(currentState.GetLocation(currentState.SearchAgentAmongLocations(initiator.Key)));
                        return true;
                    }
                }
                return false;
            }
            else if (action is Reassure || action is CounterReassure)
            {
                foreach (var agent in currentState.GetAgents())
                {
                    if (agent.Key.GetRole() == AgentRole.USUAL && agent.Value.GetStatus()
                        && currentState.GetLocation(currentState.SearchAgentAmongLocations(initiator.Key)).Value.SearchAgent(agent.Key)
                        && !agent.Key.Equals(initiator.Key) && agent.Value.AngryCheck())
                    {
                        action.Arguments.Add(agent);
                        action.Arguments.Add(initiator);
                        action.Arguments.Add(currentState.GetAgentByName(agent.Value.GetObjectOfAngry().GetObjectOfAngry().GetName()));
                        break;
                    }
                }

                foreach (var killer in currentState.GetAgents())
                {
                    if (killer.Key.GetRole() == AgentRole.KILLER && killer.Value.GetStatus())
                    {
                        action.Arguments.Add(killer);
                        break;
                    }
                }

                action.Arguments.Add(currentState.GetLocation(currentState.SearchAgentAmongLocations(initiator.Key)));
                return true;
            }
            else if (action is Run || action is CounterRun)
            {
                action.Arguments.Add(initiator);
                action.Arguments.Add(currentState.GetLocation(currentState.SearchAgentAmongLocations(initiator.Key)));
                action.Arguments.Add(currentState.
                        GetRandomLocationWithout(currentState.GetLocationByName(currentState.SearchAgentAmongLocations(initiator.Key).GetName())));
                return true;
            }
            else if (action is NothingToDo)
            {
                action.Arguments.Add(initiator);
            }
            else if (action is TellAboutASuspicious || action is CounterTellAboutASuspicious)
            {
                foreach (var agent in currentState.GetAgents())
                {
                    if (agent.Key.GetRole() == AgentRole.USUAL && agent.Value.GetStatus() 
                        && currentState.GetLocation(currentState.SearchAgentAmongLocations(initiator.Key)).Value.SearchAgent(agent.Key))
                    {
                        action.Arguments.Add(agent);
                        break;
                    }
                }

                action.Arguments.Add(initiator);
                action.Arguments.Add(currentState.GetLocation(currentState.SearchAgentAmongLocations(initiator.Key)));
                action.Arguments.Add(currentState.GetRandomLocationWithout
                    (currentState.GetLocationByName(currentState.SearchAgentAmongLocations(initiator.Key).GetName())));
                return true;
            }
            else if (action is Talk || action is CounterTalk)
            {
                action.Arguments.Add(initiator);

                foreach (var agent in currentState.GetAgents())
                {
                    if (agent.Value.GetStatus()
                        && currentState.GetLocation(currentState.SearchAgentAmongLocations(initiator.Key)).Value.SearchAgent(agent.Key)
                        && agent.Key.GetName() != initiator.Key.GetName())
                    {
                        action.Arguments.Add(agent);
                        return true;
                    }
                }

                return false;
            }
            return false;
        }