/// <summary> /// Checks if another <see cref="Ship"/> occupies any cells that this <see cref="Ship"/> occupies. /// </summary> /// <param name="otherShip">The <see cref="Ship"/> to check for confliction with.</param> /// <returns>A value indicating the state of conflicting with the <paramref name="otherShip"/>.</returns> public bool ConflictsWith(Ship otherShip) { foreach (var otherShipLocation in otherShip.GetAllLocations()) { if (this.IsAt(otherShipLocation)) { return(true); } } return(false); }
/// <summary> /// Checks if another <see cref="Ship"/> occupies any cells that this <see cref="Ship"/> occupies. /// </summary> /// <param name="otherShip">The <see cref="Ship"/> to check for confliction with.</param> /// <returns>A value indicating the state of conflicting with the <paramref name="otherShip"/>.</returns> public bool ConflictsWith(Ship otherShip) { foreach (var otherShipLocation in otherShip.GetAllLocations()) { if (this.IsAt(otherShipLocation)) { return true; } } return false; }