From a77f465bc9cf600ca1604ad6840ef865ed30f0a5 Mon Sep 17 00:00:00 2001 From: Luis Rodrigues Date: Fri, 27 Mar 2026 11:14:31 +0000 Subject: [PATCH] =?UTF-8?q?eliminar=20atalhos=20de=20teclas=20desnecess?= =?UTF-8?q?=C3=A1rios?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit atalhos removidos: m (mostrar mapa no terminal) -> temos um mapa representado em imagem, não precisamos de ter um igual e feio no terminal i (mostrar info sobre posicao especifica) -> já fazemos isso dentro da janela da app, duplicação no terminal desnecessária --- modules/gui.py | 21 +++------------------ 1 file changed, 3 insertions(+), 18 deletions(-) diff --git a/modules/gui.py b/modules/gui.py index eabbbc1..dcaa76a 100644 --- a/modules/gui.py +++ b/modules/gui.py @@ -73,11 +73,11 @@ def popularMapa(mapa: Mapa) -> None: mapa.mundo[pos_y][pos_x] = Agente(estrategia, (pos_x, pos_y)) -def mostrarEstatisticas(mapa: Mapa | None) -> dict: +def mostrarEstatisticas(mapa: Mapa | None) -> dict[str, int]: if mapa is None: print("SEM MAPA!!") else: - stats_estrategias: dict = {} + stats_estrategias: dict[str, int] = {} n_total_agentes: int = 0 print("estatisticas mapa:") for tipo_estrategia in ModEstrategia.lista_estrategias: @@ -93,6 +93,7 @@ def mostrarEstatisticas(mapa: Mapa | None) -> dict: (stats_estrategias[tipo_estrategia] / n_total_agentes) * 100:3.2f}" ) return stats_estrategias + return {} def mostrarMapa(mapa: Mapa | None) -> None: @@ -151,26 +152,10 @@ def main(mapa: Mapa | None, tamanho_mapa: tuple[int, int]): # correr proxima iteração com 'n' (next) if event.key == pg.K_n: ModInteraccoes.correrInteraccoesEntreAgentes(mapa) - if event.key == pg.K_m: - # mostrar mapa no terminal com 'm' - print("Mapa:") - mostrarMapa(mapa) # gerar novo mapa e popular (fazer reset) com 'r' if event.key == pg.K_r: mapa = Mapa(tamanho_mapa) popularMapa(mapa) - # mostrar info sobre posicao especifica com 'i' - if event.key == pg.K_i: - print("devolver informação de posicao (x,y)") - pos_x: int = int(input("posicao x: ")) - pos_y: int = int(input("posicao y: ")) - if pos_x > mapa.dimensao[0] or pos_y > mapa.dimensao[1]: - continue - agente: Agente = mapa.posicao((pos_x, pos_y)) - print( - f"{id(agente)=}\n{agente.estrategia=}\n{ - agente.personalidade=}" - ) if event.type == pg.MOUSEBUTTONDOWN: # botao 1 do rato clicado, seleccionar ou tirar selecao if pg.mouse.get_pressed(num_buttons=3)[0]: