Пример #1
0
 private void CheckPositionIsDefault(IHaveCoordinates toCheck)
 {
     if (_state.Cells[toCheck.X, toCheck.Y] != CellType.Default)
     {
         throw new PositionAlreadyTakenException(toCheck.X, toCheck.Y, _state.Cells[toCheck.X, toCheck.Y]);
     }
 }
Пример #2
0
 public void MoveTo(IHaveCoordinates newPosition)
 {
     X = newPosition.X;
     Y = newPosition.Y;
     MovesUntilDeath--;
 }
Пример #3
0
 public void Eat(IHaveCoordinates herbivore)
 {
     X = herbivore.X;
     Y = herbivore.Y;
     MovesUntilDeath = MovesLeftAfterEating;
 }
Пример #4
0
 public static IEnumerable <Coordinate> GetSurroundingCells(this IHaveCoordinates instance, int distance,
                                                            int numberOfRows,
                                                            int numberOfColumns)
 {
     return(Coordinate.GetSurroundingCells(instance.X, instance.Y, distance, numberOfRows, numberOfColumns));
 }