示例#1
0
        public bool TakeHit(Position position)
        {
            // ensure only one ship takes the hit
            if (position.X > Xaxis || position.Y > Yaxis)
            {
                throw new ArgumentOutOfRangeException(nameof(position), "Target attack point is out of range");
            }

            return(Battleships.SingleOrDefault(b => b.TakeHit(position)) != null);
        }