def random(genome): x,y = randpoint(genome.width,genome.height) #width = uniform(0.0,1.0) * genome.width #height = uniform(0.0,1.0) * genome.height width = abs(gauss(0,GROWTH_CONST)) height = abs(gauss(0,GROWTH_CONST)) angle = uniform(0.0,math.pi) color = randrgba() return Ellipse(x,y,width,height,angle,color)
def random(genome): v_min = genome.getParam('vert_min') v_max = genome.getParam('vert_max') width = genome.width height = genome.height num_vertices = randint(v_min, v_max) vertices = [randpoint(width, height)] for i in range(2): prev = vertices[-1] new = [ d + gauss(0,GROWTH_CONST) for d in prev ] vertices.append(new) #vertices = [ randpoint(width, height) for i in range(randint(v_min,v_max)) ] color = randrgba() p = Polygon(vertices, color) for i in range(num_vertices - 3): p.mut_inc_order(genome) return p