From 28210e39d5934a861998b8ee87fbbe4dd21ea90f Mon Sep 17 00:00:00 2001 From: Joscha Date: Sun, 21 May 2017 00:02:29 +0000 Subject: [PATCH] Generate smaller triangle genes Instead of choosing three random positions for the corners, now the positions of the second and third corner are mutations of the first corner's position. --- src/Genes.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/Genes.cpp b/src/Genes.cpp index 0bbe8c2..0711a7b 100644 --- a/src/Genes.cpp +++ b/src/Genes.cpp @@ -216,8 +216,12 @@ void GeneTriangle::draw(sf::RenderTarget& target, sf::RenderStates states) const void GeneTriangle::randomize() { Gene::randomizePosition(this->pos1); - Gene::randomizePosition(this->pos2); - Gene::randomizePosition(this->pos3); +// Gene::randomizePosition(this->pos2); +// Gene::randomizePosition(this->pos3); + this->pos2 = pos1; + this->pos3 = pos1; + Gene::mutatePosition(this->pos2, GeneTriangle::stddev_position); + Gene::mutatePosition(this->pos3, GeneTriangle::stddev_position); Gene::randomizeColor(this->color); }