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 #include "HeuristicReplication.h" 00026 #include "HeuristicBehaviour.h" 00027 #include "Explorer.h" 00028 #include "Warrior.h" 00029 #include "Random.h" 00030 #include "Constants.h" 00031 00032 HeuristicReplication::HeuristicReplication() : Replication() { 00033 00034 } 00035 00036 HeuristicReplication::~HeuristicReplication() { 00037 00038 } 00039 00040 std::list<Worshiper*>* HeuristicReplication::getNewWorshipers(){ 00041 00042 //Clear the list 00043 _new_worshipers->clear(); 00044 00045 //We create an explorer and a warrior 00046 Worshiper * w1 = createWorshiper(Random::value() % (MAX_WORSHIPER_SIZE / 2), 00047 Random::value() % (MAX_FOOD_CAPACITY / 2), 00048 new Explorer); 00049 00050 Worshiper * w2 = createWorshiper( 00051 MAX_WORSHIPER_SIZE + (Random::value() % (MAX_WORSHIPER_SIZE / 2)), 00052 MAX_FOOD_CAPACITY + (Random::value() % (MAX_FOOD_CAPACITY / 2)), 00053 new Warrior); 00054 00055 _new_worshipers->push_back(w1); 00056 _new_worshipers->push_back(w2); 00057 00058 return _new_worshipers; 00059 00060 }