private bool IsWithinBoard(Battleship battleship) { foreach (var coords in battleship.GetCoords()) { if (coords.X > 10 || coords.X < 0 || coords.Y > 10 || coords.Y < 0) { return(false); } } return(true); }
private bool ProcessBattleship(Coordinate coordinate, Battleship battleship) { if (battleship.GetCoords().Exists(x => x.X == coordinate.X && x.Y == coordinate.Y)) { if (battleship.Hits.Where(x => x.X == coordinate.X && x.Y == coordinate.Y).Count() == 0) { battleship.Hits.Add(coordinate); return(true); } } return(false); }