public Rook(Coordinates startCoordinates, IChessBoard chessboard) { _chessboard = chessboard ?? throw new ArgumentNullException(nameof(chessboard)); if (!_chessboard.LocationExists(startCoordinates)) { throw new InvalidStartLocationException(startCoordinates); } Location = startCoordinates; }
public Knight(Coordinates startCoordinates, IChessBoard chessboard, IMovementTracker movementTracker) { _chessboard = chessboard ?? throw new ArgumentNullException(nameof(chessboard)); _movementTracker = movementTracker ?? throw new ArgumentNullException(nameof(movementTracker)); if (!_chessboard.LocationExists(startCoordinates)) { throw new InvalidStartLocationException(startCoordinates); } Location = startCoordinates; _movementTracker.LogLocation(startCoordinates); }
public KnightV2(Coordinates startCoordinates, IChessBoard chessboard) { _chessboard = chessboard ?? throw new ArgumentNullException(nameof(chessboard)); if (!_chessboard.LocationExists(startCoordinates)) { throw new InvalidStartLocationException(startCoordinates); } _isStartPosition = true; Location = startCoordinates; _observers = new List <IObserver <Coordinates> >(); }
private KnightV2(Coordinates newCoordinates, IChessBoard chessboard, List <IObserver <Coordinates> > observers = null) { _chessboard = chessboard ?? throw new ArgumentNullException(nameof(chessboard)); if (!_chessboard.LocationExists(newCoordinates)) { throw new InvalidStartLocationException(newCoordinates); } _isStartPosition = false; Location = newCoordinates; _observers = observers ?? new List <IObserver <Coordinates> >(); PublishMovement(newCoordinates); }
public bool LocationExists(Coordinates coordinates) { return(_chessBoard.LocationExists(coordinates)); }