Adjust grid dimensions and refine cell mutation parameters for improved simulation behavior
All checks were successful
Build Simulation and Test / Run All Tests (push) Successful in 1m5s
All checks were successful
Build Simulation and Test / Run All Tests (push) Successful in 1m5s
This commit is contained in:
parent
4e90ecb885
commit
8bb5c3edfc
@ -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
|
||||
|
||||
|
||||
@ -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)
|
||||
|
||||
@ -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
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user