diff --git a/generals/core/grid.py b/generals/core/grid.py index 754e419..3029bb6 100644 --- a/generals/core/grid.py +++ b/generals/core/grid.py @@ -181,10 +181,12 @@ def create_distance_mask(distances, max_distance): g2 = None for _ in range(max_attempts): candidate_g2 = (self.rng.integers(grid_height), self.rng.integers(grid_width)) - if distances_from_g1[candidate_g2] >= min_generals_distance and distances_from_g1[candidate_g2] != float("inf"): + if distances_from_g1[candidate_g2] >= min_generals_distance and distances_from_g1[candidate_g2] != float( + "inf" + ): g2 = candidate_g2 break - + if g2 is None: # If we couldn't place g2 after max attempts, start over with a new grid return self.generate_generalsio_grid() @@ -203,7 +205,6 @@ def create_distance_mask(distances, max_distance): # Randomly select one position from the valid positions idx = self.rng.integers(0, len(valid_positions[0])) city_pos = (valid_positions[0][idx], valid_positions[1][idx]) - # Generate city value (0 - 9 or 'x') city_cost = self.rng.choice([str(i) for i in range(10)] + ["x"]) map[city_pos] = city_cost