示例#1
0
 private void AddPrey()
 {
     for (int i = 0; i < NumPreys; i++)
     {
         while (true)
         {
             byte x = (byte)_random.Next(0, NumCols);
             byte y = (byte)_random.Next(0, NumRows);
             if (_cells[x, y] == null)
             {
                 _cells[x, y] = new Prey(new Coordinate(x, y));
             }
             else
             {
                 continue;
             }
             break;
         }
     }
 }
示例#2
0
 public virtual void Reproduce(Coordinate initCoord)
 {
     Ocean1.NumBornPrey += 1;
     Ocean1[initCoord]   = new Prey(initCoord);
     Ocean1.NumPreys    += 1;
 }