Пример #1
0
        private Coordinates DamagedShipShot()
        {
            Random rand         = new Random(Guid.NewGuid().GetHashCode());
            var    hitNeighbors = EnemyBoard.GetHitNeighbors();
            var    neighborID   = rand.Next(hitNeighbors.Count);

            return(hitNeighbors[neighborID]);
        }
Пример #2
0
        public Coordinates FireShot()
        {
            var         hitNeighbors = EnemyBoard.GetHitNeighbors();
            Coordinates coords;

            if (hitNeighbors.Any())
            {
                coords = DamagedShipShot();
            }
            else
            {
                coords = RandomShot();
            }
            return(coords);
        }