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