Exemplo n.º 1
0
Arquivo: Prey.cs Projeto: mihzas/Ocean
 public Prey(Ocean ocean, int timeToReproduce = 6)
     : base(ocean)
 {
     TIME_TO_REPRODUCE = timeToReproduce;
     _timeToReproduce = timeToReproduce;
     _rand = new MyRandom();
 }
Exemplo n.º 2
0
 public Predator(Ocean ocean, int timeToFeed = 5)
     : base(ocean)
 {
     if (ocean is IProcessPredator)
     {
         _oceanPredator = ocean as IProcessPredator;
     }
     TIME_FEED = timeToFeed;
     _timeToFeed = timeToFeed;
 }
Exemplo n.º 3
0
 public Obstacle(Ocean ocean)
     : base(ocean)
 {
 }
Exemplo n.º 4
0
 static void Main(string[] args)
 {
     Ocean ocean = new Ocean();
     ocean.Run();
 }
Exemplo n.º 5
0
        private void InitCells(Ocean ocean)
        {
            AddEmptyCell(ocean);
            _numObstacles = UI.PromptToInput("How many obstacles(default 75): ");

            if (_numObstacles >= Size)
            {
                _numObstacles = NUM_OBSTACLES;
            }

            _numPredators = UI.PromptToInput("How many predators(default 20): ");

            if (_numPredators >= (Size - _numObstacles))
            {
                _numPredators = NUM_PREDATORS;
            }

            _numPreys = UI.PromptToInput("How many prey(default 150): ");
            if (_numPreys >= (Size - _numObstacles - _numPredators))
            {
                _numPreys = NUM_PREY;
            }

            AddObstacles();
            AddPredators();
            AddPreys();

            UI.DisplayStats(0, _numObstacles, _numPredators, _numPreys);
            UI.DisplayBorder(_cell.GetLength(1));
            UI.DisplayCells(_cell);
        }
Exemplo n.º 6
0
 private void AddEmptyCell(Ocean ocean)
 {
     _cell = new Cell[_numRows, _numCols];
     for (int i = 0; i < _numRows; ++i)
     {
         for (int j = 0; j < _numCols; ++j)
         {
             _cell[i, j] = new Cell(this);
         }
     }
 }
Exemplo n.º 7
0
Arquivo: Cell.cs Projeto: mihzas/Ocean
 public Cell(Ocean ocean)
 {
     _ocean = ocean;
     _isProcess = false;
 }