Exemplo n.º 1
0
        private void AddBattleShip(BattleShip battleShip)
        {
            if (!battleShip.CheckRangePosition())
            {
                throw new Exceptions.InvalidRangeException();
            }

            if (HasPositionFilled(battleShip))
            {
                throw new Exceptions.InvalidBattleShipPositionException();
            }

            _battleShips.Add(battleShip);
            foreach (var item in battleShip.Positions)
            {
                _dimension[item.X, item.Y] = item;
            }
        }