Add cell count display to sprint debug info and adjust energy cost calculation
Some checks failed
Build Simulation and Test / Run All Tests (push) Failing after 40s
Some checks failed
Build Simulation and Test / Run All Tests (push) Failing after 40s
This commit is contained in:
parent
ff43022b3a
commit
8c8d8f7925
@ -57,6 +57,14 @@ class SimulationEngine:
|
||||
|
||||
return world
|
||||
|
||||
def _count_cells(self):
|
||||
count = 0
|
||||
for entity in self.world.get_objects():
|
||||
if isinstance(entity, DefaultCell):
|
||||
count += 1
|
||||
return count
|
||||
|
||||
|
||||
def run(self):
|
||||
while self.running:
|
||||
self._handle_frame()
|
||||
@ -91,7 +99,8 @@ class SimulationEngine:
|
||||
# No rendering or camera update
|
||||
|
||||
self.renderer.clear_screen()
|
||||
self.hud.render_sprint_debug(self.screen, self.actual_tps, self.total_ticks)
|
||||
cell_count = self._count_cells()
|
||||
self.hud.render_sprint_debug(self.screen, self.actual_tps, self.total_ticks, cell_count)
|
||||
pygame.display.flip()
|
||||
self.clock.tick(MAX_FPS)
|
||||
return
|
||||
|
||||
@ -467,17 +467,20 @@ class HUD:
|
||||
screen.blit(surf, (tooltip_rect.left + TOOLTIP_PADDING_X, y))
|
||||
y += surf.get_height() + TOOLTIP_LINE_SPACING
|
||||
|
||||
def render_sprint_debug(self, screen, actual_tps, total_ticks):
|
||||
def render_sprint_debug(self, screen, actual_tps, total_ticks, cell_count):
|
||||
"""Render sprint debug info: header, TPS, and tick count."""
|
||||
header = self.font.render("Sprinting...", True, (255, 200, 0))
|
||||
tps_text = self.font.render(f"TPS: {actual_tps}", True, (255, 255, 255))
|
||||
ticks_text = self.font.render(f"Ticks: {total_ticks}", True, (255, 255, 255))
|
||||
cell_count = self.font.render(f"Cells: {cell_count}", True, (255, 255, 255))
|
||||
|
||||
y = SCREEN_HEIGHT // 2 - 40
|
||||
header_rect = header.get_rect(center=(SCREEN_WIDTH // 2, y))
|
||||
tps_rect = tps_text.get_rect(center=(SCREEN_WIDTH // 2, y + 40))
|
||||
ticks_rect = ticks_text.get_rect(center=(SCREEN_WIDTH // 2, y + 80))
|
||||
cell_rect = ticks_text.get_rect(center=(SCREEN_WIDTH // 2, y + 120))
|
||||
|
||||
screen.blit(header, header_rect)
|
||||
screen.blit(tps_text, tps_rect)
|
||||
screen.blit(ticks_text, ticks_rect)
|
||||
screen.blit(cell_count, cell_rect)
|
||||
|
||||
@ -386,7 +386,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.01) + 1 + (0.5 * movement_cost)
|
||||
self.energy -= (self.behavioral_model.neural_network.network_cost * 0.03) + 1 + (0.3 * movement_cost)
|
||||
|
||||
return self
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user