eliminar atalhos de teclas desnecessários
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
This commit is contained in:
@ -73,11 +73,11 @@ def popularMapa(mapa: Mapa) -> None:
|
|||||||
mapa.mundo[pos_y][pos_x] = Agente(estrategia, (pos_x, pos_y))
|
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:
|
if mapa is None:
|
||||||
print("SEM MAPA!!")
|
print("SEM MAPA!!")
|
||||||
else:
|
else:
|
||||||
stats_estrategias: dict = {}
|
stats_estrategias: dict[str, int] = {}
|
||||||
n_total_agentes: int = 0
|
n_total_agentes: int = 0
|
||||||
print("estatisticas mapa:")
|
print("estatisticas mapa:")
|
||||||
for tipo_estrategia in ModEstrategia.lista_estrategias:
|
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}"
|
(stats_estrategias[tipo_estrategia] / n_total_agentes) * 100:3.2f}"
|
||||||
)
|
)
|
||||||
return stats_estrategias
|
return stats_estrategias
|
||||||
|
return {}
|
||||||
|
|
||||||
|
|
||||||
def mostrarMapa(mapa: Mapa | None) -> None:
|
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)
|
# correr proxima iteração com 'n' (next)
|
||||||
if event.key == pg.K_n:
|
if event.key == pg.K_n:
|
||||||
ModInteraccoes.correrInteraccoesEntreAgentes(mapa)
|
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'
|
# gerar novo mapa e popular (fazer reset) com 'r'
|
||||||
if event.key == pg.K_r:
|
if event.key == pg.K_r:
|
||||||
mapa = Mapa(tamanho_mapa)
|
mapa = Mapa(tamanho_mapa)
|
||||||
popularMapa(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:
|
if event.type == pg.MOUSEBUTTONDOWN:
|
||||||
# botao 1 do rato clicado, seleccionar ou tirar selecao
|
# botao 1 do rato clicado, seleccionar ou tirar selecao
|
||||||
if pg.mouse.get_pressed(num_buttons=3)[0]:
|
if pg.mouse.get_pressed(num_buttons=3)[0]:
|
||||||
|
|||||||
Reference in New Issue
Block a user