示例#1
0
 /// <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);
 }
示例#2
0
            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);
            }
示例#3
0
            /// <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();
                }
            }
示例#4
0
 public override void Execute(WoodTravelerAgent agent)
 {
     agent._environment.AgentLeave(_position);
 }
示例#5
0
            public override void Execute(WoodTravelerAgent agent)
            {
                agent._environment.AgentThrowRock(_position);

                agent._beliefs[_position.X, _position.Y].ThrowRock();
            }
示例#6
0
 /// <summary>
 /// Execute l'action
 /// </summary>
 public abstract void Execute(WoodTravelerAgent agent);