Ejemplo n.º 1
0
        funcion items(); y entonces se procede a hacer las operaciones necesarias para cada agente."""
        """As the army is a dictionary, to avoid a sequential repeting acces to the same elements, the element list is disordered,
        the list is obtained by the function items (); and then the needed operations for every agent are performed"""
        lista_ejercito = mapa.ejercito.items()
        shuffle(lista_ejercito)

        """Aqui se le da tratamiento a las "actividades" que tienen que llevar a cabo los agentes."""
        """ We deal with the "activities" that agents must perform"""
        for i in range (0,len(lista_ejercito)):
                  """Si el agente esta vivo (si su atributo status es True) entonces podra ver, moverse y pelear."""
                  """If the agent is alive (atribute status is True) then he can see, move and fight """
                  soldado = lista_ejercito[i]
                  """Si la ocupacion en el ejercito en una celda dada no esta vacia."""
				  """ If army ocpuation in one cell is not empty """
                  if soldado[1]!="":
                     if mapa.estaVivo(soldado[1]) == "True":
                         #soldado[1].imprimeAgente()
                         soldado[1].Ver(mapa)
                         #soldado[1].imprimeVision()
                         soldado[1].Pelear(mapa)
                         print "--------------------------------------------------------------------------------"
                         #i.mover() #PREGUNTAR A OTTO DEL METODO MOVER, SI ES EQUIVALENTE AL MOVER_COVER

        """Se imprime el mapa solo con la informacion importante de un agente
        (id,bando,status), donde:
        bando es rojo o azul.
        status es True(el agente vive), False (el agente muere)
        esto es para ver el antes y despues de cada batalla."""
        """A map with only the relevant information of an agent is printed (id, side, status):
        side is either red or blue
        status is True (agent alive) or False (agent dead) In orther to see before and after of every battle """