/// <summary> /// Genere un nouveau bois et l'agent qui va essayer de le resoudre /// </summary> /// <param name="sqrtSize"> Taille des lignes et colonne du bois genere</param> public void GenerateWood(int sqrtSize) { GenerateAppGrid(sqrtSize); MagicWood previousWood = _currentWood; _currentWood = new MagicWood(this, sqrtSize); if (previousWood != null) { _currentWood.agentPerformance = previousWood.agentPerformance; } _currentAgent = new WoodTravelerAgent(this, _currentWood); }
public override void Execute(WoodTravelerAgent agent) { bool died = !agent._environment.MoveAgent(_position); if (!died) { agent._currentPosition = _position; AddExplorablePosition(agent); } agent._beliefs[_position.X, _position.Y].MarkedAsExplored(died); }
/// <summary> /// Ajoute les nouvelle position que le jour peut explorer a partir de celle-ci /// Ne doit etre appele que lors de la premiere exploration /// </summary> /// <param name="agent"></param> protected void AddExplorablePosition(WoodTravelerAgent agent) { int sqrSize = (int)Math.Sqrt(agent._beliefs.Length); if (_position.X + 1 < sqrSize) { agent._beliefs[_position.X + 1, _position.Y].Unblock(); } if (_position.X - 1 >= 0) { agent._beliefs[_position.X - 1, _position.Y].Unblock(); } if (_position.Y + 1 < sqrSize) { agent._beliefs[_position.X, _position.Y + 1].Unblock(); } if (_position.Y - 1 >= 0) { agent._beliefs[_position.X, _position.Y - 1].Unblock(); } }
public override void Execute(WoodTravelerAgent agent) { agent._environment.AgentLeave(_position); }
public override void Execute(WoodTravelerAgent agent) { agent._environment.AgentThrowRock(_position); agent._beliefs[_position.X, _position.Y].ThrowRock(); }
/// <summary> /// Execute l'action /// </summary> public abstract void Execute(WoodTravelerAgent agent);