private Coordinates SearchingShot() { Random rand = new Random(Guid.NewGuid().GetHashCode()); var hitNeighbors = ShotBoard.GetShotNeighbors(); var neighborID = rand.Next(hitNeighbors.Count); return(hitNeighbors[neighborID]); }
private Coordinates RandomShot() { var openTiles = ShotBoard.GetOddRandomPanels(); Random rand = new Random(Guid.NewGuid().GetHashCode()); var tileCoord = rand.Next(openTiles.Count); return(openTiles[tileCoord]); }
public Player(string name) { Name = name; Ships = new List <Ship>() { new Destroyer(), new Submarine(), new Cruiser(), new Battleship(), new Carrier() }; Board = new Board(); ShotBoard = new ShotBoard(); }
public Coordinates FireShot() { var ShotNeigbors = ShotBoard.GetShotNeighbors(); Coordinates coordinates; if (ShotNeigbors.Any()) { coordinates = SearchingShot(); } else { coordinates = RandomShot(); } return(coordinates); }