corrigido erro de limites de mapa
This commit is contained in:
@ -2,17 +2,21 @@ import random
|
|||||||
from modules.agente import Agente
|
from modules.agente import Agente
|
||||||
import modules.gui as Gui
|
import modules.gui as Gui
|
||||||
from modules.mapa import Mapa
|
from modules.mapa import Mapa
|
||||||
|
import modules.estrategia as ModEstrategia
|
||||||
|
|
||||||
tamanho_mundo: tuple[int, int] = (30, 30)
|
tamanho_mundo: tuple[int, int] = (30, 30)
|
||||||
|
|
||||||
|
ModEstrategia.carregarFicheirosEstrategias('strategies/')
|
||||||
|
|
||||||
mapa = Mapa(tamanho_mundo, aleatorio=True)
|
mapa = Mapa(tamanho_mundo, aleatorio=True)
|
||||||
mapa.mostrar()
|
mapa.mostrar()
|
||||||
|
|
||||||
# Gui.App()
|
# Gui.App()
|
||||||
|
|
||||||
print(mapa)
|
print(mapa)
|
||||||
pos_y = random.randint(0, tamanho_mundo[0])
|
pos_y = random.randint(0, tamanho_mundo[0]-1)
|
||||||
pos_x = random.randint(0, tamanho_mundo[1])
|
pos_x = random.randint(0, tamanho_mundo[1]-1)
|
||||||
|
print(f'{pos_y=} {pos_x=}')
|
||||||
obj_agente: Agente | None = mapa.posicao((pos_y, pos_x))
|
obj_agente: Agente | None = mapa.posicao((pos_y, pos_x))
|
||||||
if obj_agente is not None:
|
if obj_agente is not None:
|
||||||
print(obj_agente)
|
print(obj_agente)
|
||||||
|
|||||||
Reference in New Issue
Block a user