Changeset 803 for cpp/frams/genetics
- Timestamp:
- 06/07/18 17:42:49 (6 years ago)
- Location:
- cpp/frams/genetics
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
cpp/frams/genetics/fH/fH_general.cpp
r797 r803 189 189 } 190 190 191 int fH_Builder::parseGenotype( SStringgenotype)191 int fH_Builder::parseGenotype(const SString &genotype) 192 192 { 193 193 // Firstly, number of dimensions is parsed -
cpp/frams/genetics/fH/fH_general.h
r797 r803 408 408 * @return 0 if processing was successful, 1 if parsing of dimensions went wrong or one of genotype lines could not be parsed 409 409 */ 410 int parseGenotype( SStringgenotype);410 int parseGenotype(const SString &genotype); 411 411 412 412 /** -
cpp/frams/genetics/fH/fH_oper.cpp
r797 r803 255 255 fH_Handle *handle = NULL; 256 256 method = FH_OPCOUNT + roulette(addoperations, FH_ADD_OPCOUNT); 257 if (getActiveNeuroClassCount() == 0) method = FH_OPCOUNT + FH_ADD_STICK; 257 258 switch (method - FH_OPCOUNT) 258 259 { … … 466 467 { 467 468 nc = getRandomNeuroClass(); 468 if (!nc) nc = Neuro::getClass("N");469 // checking of neuron class availability should be checked before 469 470 } 470 471 -
cpp/frams/genetics/fL/fL_general.cpp
r797 r803 73 73 } 74 74 75 bool fL_Builder::getNextObject(int &pos, SStringsrc, SString &token)75 bool fL_Builder::getNextObject(int &pos, const SString &src, SString &token) 76 76 { 77 77 // if position exceeds length then return false … … 130 130 } 131 131 132 std::string fL_Builder::trimSpaces( std::stringdata)132 std::string fL_Builder::trimSpaces(const std::string& data) 133 133 { 134 134 size_t first = data.find_first_not_of(' '); … … 141 141 } 142 142 143 int fL_Builder::createWord( SStringtoken, fL_Word *&word, int numparams, int begin, int end)143 int fL_Builder::createWord(const SString &token, fL_Word *&word, int numparams, int begin, int end) 144 144 { 145 145 SString wordn; … … 229 229 } 230 230 231 int fL_Builder::tokenize( SStringsequence, std::list<fL_Word *> &result, int numparams, int begin, int end)231 int fL_Builder::tokenize(const SString &sequence, std::list<fL_Word *> &result, int numparams, int begin, int end) 232 232 { 233 233 int pos = 0; … … 450 450 } 451 451 452 int fL_Builder::processLine(fLElementType type, SStringline, fL_Element *&obj, int linenumber, int begin, int end)452 int fL_Builder::processLine(fLElementType type, const SString &line, fL_Element *&obj, int linenumber, int begin, int end) 453 453 { 454 454 ParamEntry *tab; … … 557 557 } 558 558 559 int fL_Builder::parseGenotype( SStringgenotype)559 int fL_Builder::parseGenotype(const SString &genotype) 560 560 { 561 561 int pos = 0; … … 1303 1303 m->checkpoint(); 1304 1304 } 1305 if (maxwords != -1 && genotype.size() > (unsigned int)maxwords)1305 if (maxwords != -1 && ((int)genotype.size()) > maxwords) 1306 1306 { 1307 1307 wordsexceeded = true; -
cpp/frams/genetics/fL/fL_general.h
r797 r803 315 315 * @return string with trimmed spaces 316 316 */ 317 static std::string trimSpaces( std::stringdata);317 static std::string trimSpaces(const std::string& data); 318 318 319 319 /** … … 328 328 * @return 0 if processing ended successfully, 1-based position of error otherwise 329 329 */ 330 int processLine(fLElementType type, SStringline, fL_Element *&obj, int linenumber, int begin, int end);330 int processLine(fLElementType type, const SString &line, fL_Element *&obj, int linenumber, int begin, int end); 331 331 332 332 /** … … 343 343 * @return 0 if processing finished successfully, 1-based position of error if it occured 344 344 */ 345 int parseGenotype( SStringgenotype);345 int parseGenotype(const SString &genotype); 346 346 347 347 /** … … 365 365 * @return true if new token is found, false if there is no more tokens or when there was parenthesis mismatch (if pos == -1, then it is parenthesis mismatch) 366 366 */ 367 bool getNextObject(int &pos, SStringsrc, SString &token);367 bool getNextObject(int &pos, const SString &src, SString &token); 368 368 369 369 /** … … 376 376 * @return 0 if conversion went successfully, 1 when there is a problem with parsing 377 377 */ 378 int createWord( SStringworddef, fL_Word *&word, int numparams, int begin, int end);378 int createWord(const SString &worddef, fL_Word *&word, int numparams, int begin, int end); 379 379 380 380 /** … … 385 385 * @return 0 if tokenizing finished successfully, 1 otherwise 386 386 */ 387 int tokenize( SStringsequence, std::list<fL_Word *> &result, int numparams, int begin, int end);387 int tokenize(const SString &sequence, std::list<fL_Word *> &result, int numparams, int begin, int end); 388 388 389 389 /** … … 452 452 * @return pointer to the input neuron, or NULL if no neuron could be found 453 453 */ 454 Neuro *findInputNeuron(std::pair<std::list<fL_Word *>::iterator, Neuro *> currneu, fL_Word *attractor);454 Neuro* findInputNeuron(std::pair<std::list<fL_Word *>::iterator, Neuro *> currneu, fL_Word *attractor); 455 455 456 456 /** -
cpp/frams/genetics/fL/fL_oper.cpp
r797 r803 142 142 SString det; 143 143 NeuroClass *cls = getRandomNeuroClass(); 144 if (!cls) cls = Neuro::getClass("N");144 //we do not check if this class 145 145 det = cls->getName(); 146 146 Geno_fH::mutateNeuronProperties(det); … … 202 202 return creature->words["S"]; 203 203 case FL_ADD_NEURO: 204 return creature->words["N"]; 204 if (getActiveNeuroClassCount() == 0) 205 return creature->words["S"]; 206 else 207 return creature->words["N"]; 205 208 case FL_ADD_CONN: 206 209 return creature->words["C"];
Note: See TracChangeset
for help on using the changeset viewer.