Exemple #1
0
        public WoodTravelerAgent(MainWindow appDisplayer, MagicWood environment)
        {
            _appDisplayer    = appDisplayer;
            _environment     = environment;
            _currentPosition = _environment.PlaceAgent();
            _rules           = RulesGenerator.Instance.GeneratedRules;

            _beliefs = new WoodSquare[environment.SqrtSize, environment.SqrtSize];
            for (int x = 0; x < environment.SqrtSize; x++)
            {
                for (int y = 0; y < environment.SqrtSize; y++)
                {
                    _beliefs[x, y] = new WoodSquare(new Vector2(x, y));
                    if (x == _currentPosition.X && y == _currentPosition.Y)
                    {
                        _beliefs[x, y].MarkedAsExplored(false);
                    }
                    if (((x == _currentPosition.X - 1 || x == _currentPosition.X + 1) && y == _currentPosition.Y) ||
                        ((y == _currentPosition.Y + 1 || y == _currentPosition.Y - 1) && x == _currentPosition.X))
                    {
                        _beliefs[x, y].Unblock();
                    }
                }
            }
        }
Exemple #2
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);
 }