diff --git a/config/constants.py b/config/constants.py index febbb66..06ea318 100644 --- a/config/constants.py +++ b/config/constants.py @@ -19,8 +19,8 @@ SELECTION_GRAY = (128, 128, 128, 80) SELECTION_BORDER = (80, 80, 90) # Grid settings -GRID_WIDTH = 100 -GRID_HEIGHT = 100 +GRID_WIDTH = 50 +GRID_HEIGHT = 50 CELL_SIZE = 20 RENDER_BUFFER = 50 diff --git a/core/simulation_engine.py b/core/simulation_engine.py index 90c5982..3439434 100644 --- a/core/simulation_engine.py +++ b/core/simulation_engine.py @@ -81,13 +81,13 @@ class SimulationEngine: if FOOD_SPAWNING: for _ in range(FOOD_OBJECTS_COUNT): - x = random.randint(-half_width, half_width) - y = random.randint(-half_height, half_height) + x = random.randint(-half_width // 2, half_width // 2) + y = random.randint(-half_height // 2, half_height // 2) world.add_object(FoodObject(Position(x=x, y=y))) for _ in range(300): new_cell = DefaultCell( - Position(x=random.randint(-half_width, half_width), y=random.randint(-half_height, half_height)), + Position(x=random.randint(-half_width // 2, half_width // 2), y=random.randint(-half_height // 2, half_height // 2)), Rotation(angle=0) ) new_cell.behavioral_model = new_cell.behavioral_model.mutate(3) diff --git a/world/objects.py b/world/objects.py index 011ff08..82670c3 100644 --- a/world/objects.py +++ b/world/objects.py @@ -315,10 +315,10 @@ class DefaultCell(BaseEntity): duplicate_y_2 += random.randint(-self.max_visual_width, self.max_visual_width) new_cell = DefaultCell(Position(x=int(duplicate_x), y=int(duplicate_y)), Rotation(angle=random.randint(0, 359))) - new_cell.set_brain(self.behavioral_model.mutate(0.4)) + new_cell.set_brain(self.behavioral_model.mutate(0.025)) new_cell_2 = DefaultCell(Position(x=int(duplicate_x_2), y=int(duplicate_y_2)), Rotation(angle=random.randint(0, 359))) - new_cell_2.set_brain(self.behavioral_model.mutate(0.4)) + new_cell_2.set_brain(self.behavioral_model.mutate(0.025)) return [new_cell, new_cell_2] @@ -350,7 +350,7 @@ class DefaultCell(BaseEntity): movement_cost = abs(output_data["angular_acceleration"]) + abs(output_data["linear_acceleration"]) - self.energy -= (self.behavioral_model.neural_network.network_cost * 0.1) + 1 + (0.3 * movement_cost) + self.energy -= (self.behavioral_model.neural_network.network_cost * 0.15) + 1 + (0.3 * movement_cost) return self