00001 00008 /* 00009 This file is part of Teapot Colony Wars. 00010 00011 Teapot Colony Wars is free software: you can redistribute it and/or modify 00012 it under the terms of the GNU General Public License as published by 00013 the Free Software Foundation, either version 2 of the License, or 00014 (at your option) any later version. 00015 00016 Teapot Colony Wars is distributed in the hope that it will be useful, 00017 but WITHOUT ANY WARRANTY; without even the implied warranty of 00018 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00019 GNU General Public License for more details. 00020 00021 You should have received a copy of the GNU General Public License 00022 along with Teapot Colony Wars. If not, see <http://www.gnu.org/licenses/>. 00023 */ 00024 00025 #ifndef GENETICREPLICATION_H 00026 #define GENETICREPLICATION_H 00027 00028 #include "Replication.h" 00029 00030 #include <map> 00031 00032 //The uncertainty interval for selection of individuals 00033 #define GENETIC_RANDOM_I ((int) MAX_FOOD_CAPACITY / 20) 00034 00035 //The lower it is, the more probably mutations will occur 00036 #define GENETIC_MUTATE_PROBA 10 00037 00038 //The maximum number of survivors kept in the mempry of the colony 00039 #define GENETIC_MAX_SURVIVORS 20 00040 00041 class GeneticBehaviour; 00042 class GeneticCode; 00043 00047 class GeneticReplication : public Replication 00048 { 00049 protected: 00050 00052 std::map<GeneticCode*,unsigned int> _survivors; 00053 00060 virtual unsigned int evaluation(Worshiper * w); 00061 00068 Worshiper* createWorshiper(GeneticBehaviour * b); 00069 00070 public: 00071 00075 GeneticReplication(); 00076 00080 virtual ~GeneticReplication(); 00081 00087 virtual std::list<Worshiper*>* getNewWorshipers(); 00088 00094 virtual void addSurvivor(Worshiper * w); 00095 00096 }; 00097 00098 #endif // GENETICREPLICATION_H