Changeset 821
- Timestamp:
- 10/10/18 01:13:05 (6 years ago)
- Location:
- cpp/frams/genetics
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
cpp/frams/genetics/fB/fB_conv.cpp
r802 r821 163 163 fHgenotype.getNextToken(fHpos, line, '\n'); 164 164 map->add(ranges[t][q].begin, ranges[t][q].end, lastpos, fHpos - 1); 165 lastpos = fHpos; 165 166 } 166 167 } -
cpp/frams/genetics/fB/fB_oper.cpp
r802 r821 39 39 } 40 40 41 bool Geno_fB::hasStick( SStringgenotype)41 bool Geno_fB::hasStick(const SString &genotype) 42 42 { 43 43 for (int i = 0; i < fB_GenoHelpers::geneCount(genotype); i++) … … 194 194 } 195 195 196 SString Geno_fB::detokenizeSequence(std::list<SString> tokenlist)196 SString Geno_fB::detokenizeSequence(std::list<SString> *tokenlist) 197 197 { 198 198 SString res = ""; 199 for (std::list<SString>::iterator it = tokenlist .begin(); it != tokenlist.end(); it++)199 for (std::list<SString>::iterator it = tokenlist->begin(); it != tokenlist->end(); it++) 200 200 { 201 201 res += (*it); … … 204 204 } 205 205 206 std::list<SString> Geno_fB::tokenizeSequence( SStringgenotype)206 std::list<SString> Geno_fB::tokenizeSequence(const SString &genotype) 207 207 { 208 208 std::list<SString> res; … … 278 278 chg = (double)def.len() / line.len(); 279 279 } 280 line = detokenizeSequence( tokenized);280 line = detokenizeSequence(&tokenized); 281 281 break; 282 282 } … … 297 297 tokenized.insert(it, res); 298 298 chg = (double)classdef.len() / line.len(); 299 line = detokenizeSequence( tokenized);299 line = detokenizeSequence(&tokenized); 300 300 break; 301 301 } … … 312 312 letter.directWrite()[0] = 'a' + randomN(26); 313 313 tokenized.insert(it, letter); 314 line = detokenizeSequence( tokenized);314 line = detokenizeSequence(&tokenized); 315 315 break; 316 316 } … … 323 323 std::advance(it, rndid); 324 324 tokenized.erase(it); 325 line = detokenizeSequence( tokenized);325 line = detokenizeSequence(&tokenized); 326 326 break; 327 327 } … … 363 363 // SString result = line.substr(0, cuts[0]) + second + 364 364 // line.substr(cuts[1], cuts[2] - cuts[1]) + first + line.substr(cuts[3]); 365 line = detokenizeSequence( res);365 line = detokenizeSequence(&res); 366 366 chg = (float)(cuts[3] - cuts[2] + cuts[1] - cuts[0]) / line.len(); 367 367 break; -
cpp/frams/genetics/fB/fB_oper.h
r797 r821 30 30 { 31 31 private: 32 bool hasStick( SStringgenotype);33 SString detokenizeSequence(std::list<SString> tokenlist);34 std::list<SString> tokenizeSequence( SStringgenotype);32 bool hasStick(const SString &genotype); 33 SString detokenizeSequence(std::list<SString> *tokenlist); 34 std::list<SString> tokenizeSequence(const SString &genotype); 35 35 36 36 public: -
cpp/frams/genetics/fH/fH_general.cpp
r803 r821 344 344 // Creature build functions 345 345 346 Part * fH_StickHandle::createPart(ParamEntry *tab, std::vector<fH_StickHandle *> children, Model *model, bool createmapping)346 Part * fH_StickHandle::createPart(ParamEntry *tab, std::vector<fH_StickHandle *> *children, Model *model, bool createmapping) 347 347 { 348 348 Param par(tab, obj); … … 353 353 } 354 354 355 unsigned int stickscount = children .size() + 1;355 unsigned int stickscount = children->size() + 1; 356 356 357 357 MultiRange ranges; 358 358 ranges.add(begin, end); 359 359 360 for (fH_StickHandle *child : children)360 for (fH_StickHandle *child : (*children)) 361 361 { 362 362 par.select(child->obj); … … 753 753 { 754 754 vector<fH_StickHandle *> emptylist; 755 Part *firstpart = currstick->createPart(stickparamtab, emptylist, model, createmapping);755 Part *firstpart = currstick->createPart(stickparamtab, &emptylist, model, createmapping); 756 756 firstpart->p = Pt3D(0); 757 757 currstick->firstpart = firstpart; … … 847 847 } 848 848 // create part from current stick and other sticks connected to this part 849 Part *secondpart = currstick->createPart(stickparamtab, children, model, createmapping);849 Part *secondpart = currstick->createPart(stickparamtab, &children, model, createmapping); 850 850 secondpart->p = secondposition; 851 851 currstick->secondpart = secondpart; -
cpp/frams/genetics/fH/fH_general.h
r803 r821 173 173 * @return created part 174 174 */ 175 Part *createPart(ParamEntry *tab, std::vector<fH_StickHandle *> children, Model *model, bool createmapping);175 Part *createPart(ParamEntry *tab, std::vector<fH_StickHandle *> *children, Model *model, bool createmapping); 176 176 177 177 /** -
cpp/frams/genetics/fL/fL_general.cpp
r803 r821 488 488 std::string message = "Error in parsing parameters at line: " + std::to_string(linenumber); 489 489 logMessage("fL_Builder", "processLine", LOG_ERROR, message.c_str()); 490 delete obj;490 if (obj != this) delete obj; 491 491 return begin + 1; 492 492 } … … 1339 1339 } 1340 1340 1341 int fL_Builder::countSticksInSequence(std::list<fL_Word *> sequence)1341 int fL_Builder::countSticksInSequence(std::list<fL_Word *> *sequence) 1342 1342 { 1343 1343 int count = 0; 1344 for (std::list<fL_Word *>::iterator it = sequence .begin(); it != sequence.end(); it++)1344 for (std::list<fL_Word *>::iterator it = sequence->begin(); it != sequence->end(); it++) 1345 1345 { 1346 1346 if ((*it)->builtin && (*it)->name == "S") -
cpp/frams/genetics/fL/fL_general.h
r803 r821 482 482 * @return number of sticks in sequence 483 483 */ 484 int countSticksInSequence(std::list<fL_Word *> sequence);484 int countSticksInSequence(std::list<fL_Word *> *sequence); 485 485 486 486 /** -
cpp/frams/genetics/fL/fL_matheval.cpp
r797 r821 116 116 registerOperator(meqless, 1, Associativity::LEFT, "<="); 117 117 registerOperator(mequal, 1, Associativity::RIGHT, "="); 118 registerOperator(mnotequal, 1, Associativity::RIGHT, " ~");118 registerOperator(mnotequal, 1, Associativity::RIGHT, "<>"); 119 119 registerOperator(mand, 0, Associativity::LEFT, "&"); 120 120 registerOperator(mor, 0, Associativity::LEFT, "|"); -
cpp/frams/genetics/fL/fL_oper.cpp
r803 r821 64 64 } 65 65 66 if (builder.countSticksInSequence( builder.genotype) == 0)66 if (builder.countSticksInSequence(&builder.genotype) == 0) 67 67 { 68 68 return GENOPER_OPFAIL; … … 142 142 SString det; 143 143 NeuroClass *cls = getRandomNeuroClass(); 144 //we do not check if this class145 144 det = cls->getName(); 146 145 Geno_fH::mutateNeuronProperties(det); … … 418 417 int ruleid = 0; 419 418 std::list<fL_Word *> *list = selectRandomSequence(creature, numpars, ruleid); 420 if (ruleid == -1 && creature->countSticksInSequence( (*list)) == 1)419 if (ruleid == -1 && creature->countSticksInSequence(list) == 1) 421 420 { 422 421 if (list->size() > 1) … … 540 539 } 541 540 int chgtype = roulette(chgoperations, FL_CHG_COUNT); 542 if (creature->countSticksInSequence( (*list)) == 1 && tmp == -1) // if sequence is axiom541 if (creature->countSticksInSequence(list) == 1 && tmp == -1) // if sequence is axiom 543 542 { 544 543 fL_Word *worddef = randomWordDefinition(creature, roulette(addtypes, FL_ADD_COUNT - 1));
Note: See TracChangeset
for help on using the changeset viewer.