def crossingover(self, other): """ pre: isinstance(other, VoronoiDiagramLayer) pre: isinstance(self, VoronoiDiagramLayer) # check for distinct references, needs to copy content, not references post: __return__ is not self post: __return__ is not other post: model_locus.unique_check(__return__, self, other) == '' """ new_one = VoronoiDiagramLayer(self.get_trunk()) cross_sequence = self.crossingover_base(new_one, other, 2) new_one.sites_point = model_random.crossingover_list( self.sites_point, other.sites_point) new_one.colorgamut = other.colorgamut.copy() if cross_sequence[0] \ else self.colorgamut.copy() new_one.sites_color = model_random.crossingover_list( self.sites_color, other.sites_color) for cix in range(len(new_one.sites_color)): new_one.colorgamut.adjust_color(new_one.sites_color[cix]) new_one.order = self.order if cross_sequence[1] else other.order new_one.sampler = model_random.crossingover_elem( self.sampler, other.sampler) new_one.stamp = model_random.crossingover_elem(self.stamp, other.stamp) return new_one
def crossingover(self, other): """ pre: isinstance(other, FilledSpline) pre: isinstance(self, FilledSpline) # check for distinct references, needs to copy content, not references post: __return__ is not self post: __return__ is not other post: model_locus.unique_check(__return__, self, other) == '' """ new_one = FilledSpline(self.get_trunk()) crossing = self.crossingover_base(new_one, other, 3) if crossing[0]: new_one.colorgamut = other.colorgamut.copy() new_one.linecolor = other.linecolor.copy() new_one.fillcolor = other.fillcolor.copy() else: new_one.colorgamut = self.colorgamut.copy() new_one.linecolor = self.linecolor.copy() new_one.fillcolor = self.fillcolor.copy() new_one.line_width = other.line_width if crossing[ 1] else self.line_width new_one.roundness = other.roundness if crossing[2] else self.roundness new_one.center = self.center.crossingover(other.center) new_one.sampler = model_random.crossingover_elem( self.sampler, other.sampler) return new_one
def crossingover(self, other): """ pre: isinstance(other, MarkovChainLayer) pre: isinstance(self, MarkovChainLayer) # check for distinct references, needs to copy content, not references post: __return__ is not self post: __return__ is not other post: model_locus.unique_check(__return__, self, other) == '' """ new_one = MarkovChainLayer(self.get_trunk()) cross_sequence = self.crossingover_base(new_one, other, 2) new_one.sampler = model_random.crossingover_elem( self.sampler, other.sampler) new_one.stamp = model_random.crossingover_elem(self.stamp, other.stamp) if cross_sequence[1]: probability = other.probability cell_colors = other.cell_colors new_one.states = other.states else: probability = self.probability cell_colors = self.cell_colors new_one.states = self.states new_one.probability = [[1.0 / new_one.states] * new_one.states for dummy in range(new_one.states)] for row, row_probabilities in enumerate(probability): for col, cell_probability in enumerate(row_probabilities): new_one.probability[row][col] = cell_probability new_one.colorgamut = other.colorgamut.copy() if cross_sequence[0] \ else self.colorgamut.copy() new_one.cell_colors = [] for cix in range(len(cell_colors)): color = cell_colors[cix].copy() new_one.colorgamut.adjust_color(color) new_one.cell_colors.append(color) return new_one
def crossingover(self, other): """ pre: isinstance(other, CircularArc) pre: isinstance(self, CircularArc) # check for distinct references, needs to copy content, not references post: __return__ is not self post: __return__ is not other post: model_locus.unique_check(__return__, self, other) == '' """ new_one = CircularArc(self.get_trunk()) crossing = self.crossingover_base(new_one, other, 4) new_one.linecolor = self.linecolor.crossingover(other.linecolor) new_one.line_width = self.line_width if crossing[ 0] else other.line_width new_one.size = self.size if crossing[1] else other.size new_one.start_angle = self.start_angle if crossing[ 2] else other.start_angle new_one.angle = self.angle if crossing[3] else other.angle new_one.sampler = model_random.crossingover_elem( self.sampler, other.sampler) return new_one
def crossingover(self, other): """ pre: isinstance(other, LetterPress) pre: isinstance(self, LetterPress) # check for distinct references, needs to copy content, not references post: __return__ is not self post: __return__ is not other post: model_locus.unique_check(__return__, self, other) == '' """ new_one = LetterPress(self.get_trunk()) crossing = self.crossingover_base(new_one, other, 7) new_one.textcolor = self.textcolor.crossingover(other.textcolor) new_one.center = self.center.crossingover(other.center) new_one.sampler = model_random.crossingover_elem(self.sampler, other.sampler) new_one.buzzwords = self.buzzwords.crossingover(other.buzzwords) new_one.family = self.family if crossing[3] else other.family new_one.style = self.style if crossing[4] else other.style new_one.size = self.size if crossing[5] else other.size new_one.weight = self.weight if crossing[6] else other.weight return new_one