// the perception is created and generated here public Percept(SimulationState state, int agentID, bool inProlog = true) { //SimulationEngineComponentScript.ss.stdout.Send("entro al constructor de Percept"); if (inProlog) { auxList = new List <string>(); auxList.Add("time(" + SimulationState.getInstance().gameTime + ")"); if (state.agents.ContainsKey(agentID)) { state.agents[agentID].agentController.perceive(this); foreach (IPerceivableEntity e in elements) { aux = e.toProlog(); auxList.Add(aux); } //auxList.Add(state.agents[agentID].agentController.selfProperties()); p = PrologList.AtomList <string>(auxList); } else { Debug.LogError("Percept creation fail."); } } else { // xml throw new NotImplementedException(); } }
public override string toProlog() { List <string> content = new List <string>(); foreach (EObject eo in this.content) { content.Add(eo.toProlog()); } return(base.toProlog() + String.Format("[[has, {0}]])", PrologList.AtomList <string>(content))); }
public override string toProlog() { List <string> forbAgents = new List <string>(); foreach (Agent ag in forbiddenEntry.Keys.ToList()) { if (isForbidden(ag)) { forbAgents.Add("[" + ag.getPrologId() + "," + forbiddenEntry[ag].getEnd() + "]"); } } return(base.toProlog() + String.Format("[[forbidden_entry, {0}]])", PrologList.AtomList <string>(forbAgents))); }
public override string toProlog() { string aux = base.toProlog(); List <string> auxList = new List <string>(); foreach (EObject eo in this.backpack) { auxList.Add(eo.toProlog()); } aux = aux + String.Format("[[life, {0}], [lifeTotal, {1}], [skill, {2}], [lastAction, [{3}, {4}]], [has, {5}]])", this.life, this.lifeTotal, this.skill, this.agentState.lastAction.toProlog(), this.agentState.lastActionTime, PrologList.AtomList <string>(auxList)); return(aux); }
public string toProlog() { List <string> neighbors = (List <string>)nodeToAdyacencyList[this._node]; if (neighbors == null) { neighbors = weightedConnections(); nodeToAdyacencyList.Add(this._node, neighbors); } return(String.Format("node({0}, {1}, {2})", this._node.GetIndex(), Entity.Vector3ToProlog((Vector3)this._node.position), PrologList.AtomList <string>(neighbors))); }