Example #1
0
File: Prey.cs Project: mihzas/Ocean
 public Prey(Ocean ocean, int timeToReproduce = 6)
     : base(ocean)
 {
     TIME_TO_REPRODUCE = timeToReproduce;
     _timeToReproduce = timeToReproduce;
     _rand = new MyRandom();
 }
Example #2
0
 public Predator(Ocean ocean, int timeToFeed = 5)
     : base(ocean)
 {
     if (ocean is IProcessPredator)
     {
         _oceanPredator = ocean as IProcessPredator;
     }
     TIME_FEED = timeToFeed;
     _timeToFeed = timeToFeed;
 }
Example #3
0
 public Obstacle(Ocean ocean)
     : base(ocean)
 {
 }
Example #4
0
 static void Main(string[] args)
 {
     Ocean ocean = new Ocean();
     ocean.Run();
 }
Example #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);
        }
Example #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);
         }
     }
 }
Example #7
0
File: Cell.cs Project: mihzas/Ocean
 public Cell(Ocean ocean)
 {
     _ocean = ocean;
     _isProcess = false;
 }