Exemplo n.º 1
0
        static Coordinate GetRightLocationToShot(Board victimboard)
        {
            List <Coordinate> tmpList = new List <Coordinate> {
            };

            for (int i = 0; i < victimboard.Ships.Length; i++)
            {
                Ship tmpShip = victimboard.Ships[i];
                for (int j = 0; j < tmpShip.BoardPositions.Length; j++)
                {
                    if (victimboard.CheckCoordinate(tmpShip.BoardPositions[j]) == ShotRecord.Unknown)
                    {
                        tmpList.Add(tmpShip.BoardPositions[j]);
                    }
                }
            }

            return(tmpList[GetRandom.r.Next(0, tmpList.Count - 1)]);
        }