def __init__(self,tab): self.tab = tab self.continents = [] self.size = 0 self.tab.iter(self._makeContinent) for cont in self.continents: regions = GenRegionPasse(self.tab,cont.liste,int(20 * (len(cont.liste) / self.size ))) regions.finalisation() cont.regions = regions.regions
def plaque(self,args = {"nombre" : 5, "plaques" : 8}): for x,y in self.tab.iterC(): self.tab[x,y] = Case(x,y) self.tab[x,y].value = 0 liste = [ elt for elt in self.tab.iterB(1) ] nombre = args["nombre"] plaque = args["plaques"] plaques = GenRegionPasse(self.tab,None,plaque,5) plaques.finalisation() liste_plaque = [ (elt.interieur,elt.frontiere) for elt in plaques.regions] for i in range(nombre): li,lf = liste_plaque[randrange(len(liste_plaque))] liste_plaque.remove((li,lf)) for elt in [ (elt.u,elt.v) for elt in li if (elt.u,elt.v) in liste]: #self.tab[elt].value = randint((self.minValue + self.maxValue) * 3 // 4 , self.maxValue ) self.tab[elt].value = int(((plaques.iteration - self.tab[elt].nb + 1) / plaques.iteration)* self.maxValue)