diff --git a/modules/gui.py b/modules/gui.py index dcaa76a..e7576fb 100644 --- a/modules/gui.py +++ b/modules/gui.py @@ -73,7 +73,7 @@ def popularMapa(mapa: Mapa) -> None: mapa.mundo[pos_y][pos_x] = Agente(estrategia, (pos_x, pos_y)) -def mostrarEstatisticas(mapa: Mapa | None) -> dict[str, int]: +def prepararEstatistica(mapa: Mapa | None) -> dict[str, int]: if mapa is None: print("SEM MAPA!!") else: @@ -87,11 +87,11 @@ def mostrarEstatisticas(mapa: Mapa | None) -> dict[str, int]: tmp_agente = mapa.posicao((pos_y, pos_x)) stats_estrategias[tmp_agente.estrategia] += 1 n_total_agentes += 1 - for tipo_estrategia in stats_estrategias: - print( - f"{tipo_estrategia}: { - (stats_estrategias[tipo_estrategia] / n_total_agentes) * 100:3.2f}" - ) + # for tipo_estrategia in stats_estrategias: + # print( + # f"{tipo_estrategia}: { + # (stats_estrategias[tipo_estrategia] / n_total_agentes) * 100:3.2f}" + # ) return stats_estrategias return {} @@ -120,7 +120,7 @@ def main(mapa: Mapa | None, tamanho_mapa: tuple[int, int]): running: bool = True # cor1: tuple[int, int, int, int] = (255, 0, 0, 0) # cor2: tuple[int, int, int, int] = (0, 255, 0, 0) - mostrarMapa(mapa) + # mostrarMapa(mapa) quadrado_seleccionado: pg.Rect | None = None while running: @@ -146,9 +146,6 @@ def main(mapa: Mapa | None, tamanho_mapa: tuple[int, int]): janela.fill(0) mapa = Mapa(tamanho_mapa) popularMapa(mapa) - # mostrar estatisticas do mapa com 's' (stats) - if event.key == pg.K_s: - mostrarEstatisticas(mapa) # correr proxima iteração com 'n' (next) if event.key == pg.K_n: ModInteraccoes.correrInteraccoesEntreAgentes(mapa) @@ -217,7 +214,7 @@ def main(mapa: Mapa | None, tamanho_mapa: tuple[int, int]): janela_stats.fill(pg.Color(0, 0, 0, 0)) janela.blit(janela_stats, (janela.get_size()[0] - 200, 10)) font = pg.font.Font(None, 20) - dict_estrat = mostrarEstatisticas(mapa) + dict_estrat = prepararEstatistica(mapa) n_linhas = 0 for strat in dict_estrat: strat_label = font.render(