adaptar escolha aleatória de estratégias
This commit is contained in:
@ -1,7 +1,9 @@
|
|||||||
# funções associadas a operações com o Mapa
|
# funções associadas a operações com o Mapa
|
||||||
|
|
||||||
|
import random
|
||||||
from modules import agente
|
from modules import agente
|
||||||
from modules.agente import Agente
|
from modules.agente import Agente
|
||||||
|
import modules.estrategia as ModEstrategia
|
||||||
|
|
||||||
|
|
||||||
class Mapa:
|
class Mapa:
|
||||||
@ -19,11 +21,12 @@ class Mapa:
|
|||||||
\tdimensao: {self.dimensao[0]} x {self.dimensao[1]}'
|
\tdimensao: {self.dimensao[0]} x {self.dimensao[1]}'
|
||||||
|
|
||||||
def inicializar(self, aleatorio: bool = False) -> list:
|
def inicializar(self, aleatorio: bool = False) -> list:
|
||||||
|
nomes_estrategias = ModEstrategia.listaNomesEstrategias()
|
||||||
# inicializar mundo
|
# inicializar mundo
|
||||||
for _ in range(0, self.dimensao[0]):
|
for _ in range(0, self.dimensao[0]):
|
||||||
mundo_tmp: list = []
|
mundo_tmp: list = []
|
||||||
for _ in range(0, self.dimensao[1]):
|
for _ in range(0, self.dimensao[1]):
|
||||||
mundo_tmp.append(Agente(aleatorio))
|
mundo_tmp.append(Agente(random.choice(nomes_estrategias)))
|
||||||
self.mundo.append(mundo_tmp)
|
self.mundo.append(mundo_tmp)
|
||||||
return self.mundo
|
return self.mundo
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user