From b81d71a34fc7b18764f2ab75e6e29949a811a532 Mon Sep 17 00:00:00 2001
From: =?utf8?q?Rafa=C5=82=20D=C5=82ugo=C5=82=C4=99cki?=
 <rafal@dlugolecki.net.pl>
Date: Sat, 4 Apr 2015 22:37:39 +0200
Subject: [PATCH] Small fixes in Condition checking.

---
 src/condition/condition.h | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/src/condition/condition.h b/src/condition/condition.h
index be7c798..d9a1373 100644
--- a/src/condition/condition.h
+++ b/src/condition/condition.h
@@ -39,13 +39,17 @@ namespace genetic {
          * @return true if condition is satisfied and another generation can checked;
          *      false if condition is not satisfied and algorithm should stop.
          */
-        virtual bool check(Generation<_Chromosome> generation) {
-            if (currentGeneration >= maxNumberOfGenerations) {
-                return false;
-            }
+        virtual bool check(Generation<_Chromosome>) {
+            /* Initial population is never checked, as method is invoked after
+             * selection, crossover and mutation. It is safe to increment it now.
+             */
             currentGeneration++;
 
-            return true;
+            if (currentGeneration < maxNumberOfGenerations) {
+                return true;
+            }
+
+            return false;
         }
     };
 }
-- 
2.30.2