alterada interação com tecla c (change)
agora a tecla c (change) permite alterar o tamanho do mapa. para fazer reset, usa-se agora a tecla 'r' (reset)
This commit is contained in:
@ -2,6 +2,7 @@
|
||||
from enum import Enum
|
||||
import json
|
||||
import os
|
||||
from types import NoneType
|
||||
|
||||
|
||||
class TiposEstrategia(Enum):
|
||||
@ -14,13 +15,13 @@ class TiposEstrategia(Enum):
|
||||
|
||||
# lista de estratégias. cada entrada é um dicionário com nome de estratégia
|
||||
# e respectivos tracos de personalidade
|
||||
lista_estrategias: dict = {}
|
||||
lista_estrategias: dict[str, float] = {}
|
||||
|
||||
|
||||
def carregarFicheirosEstrategias(pasta_estrategias: str) -> None:
|
||||
lista_ficheiros: list = os.listdir(pasta_estrategias)
|
||||
for ficheiro_json in lista_ficheiros:
|
||||
with open(f'{pasta_estrategias}/{ficheiro_json}', 'r') as ficheiro:
|
||||
with open(f"{pasta_estrategias}/{ficheiro_json}", "r") as ficheiro:
|
||||
dados = json.load(ficheiro)
|
||||
lista_estrategias.update(dados)
|
||||
|
||||
@ -29,7 +30,8 @@ def listaNomesEstrategias() -> list:
|
||||
return list(lista_estrategias.keys())
|
||||
|
||||
|
||||
def devolvePersonalidade(nome_estrategia: str) -> dict[str, float] | None:
|
||||
personalidade: dict[str, float] | None = lista_estrategias.get(
|
||||
nome_estrategia)
|
||||
def devolvePersonalidade(nome_estrategia: str | None) -> dict[str, float]:
|
||||
if isinstance(nome_estrategia, NoneType):
|
||||
raise ValueError("estratégia {nome_estrategia=} não é válida")
|
||||
personalidade: dict[str, float] = lista_estrategias.get(nome_estrategia)
|
||||
return personalidade
|
||||
|
||||
Reference in New Issue
Block a user