Beispiel #1
0
 public ChessboardPosition MovedBy(PositionChange positionChange)
 {
     if (!CanMoveBy(positionChange))
     {
         throw new DomainConstraintViolationException(
                   $"A move by [{positionChange.X}, {positionChange.Y}] is not allowed from the position [{X}, {Y}");
     }
     return(new ChessboardPosition(X + positionChange.X, Y + positionChange.Y));
 }
Beispiel #2
0
 public bool CanMoveBy(PositionChange positionChange)
 {
     return(IsValidPosition(X + positionChange.X, Y + positionChange.Y));
 }