- Timestamp:
- 02/15/19 03:09:31 (6 years ago)
- Location:
- cpp/frams/genetics
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
cpp/frams/genetics/f4/f4_general.cpp
r830 r853 1 1 // This file is a part of Framsticks SDK. http://www.framsticks.com/ 2 // Copyright (C) 1999-201 8Maciej Komosinski and Szymon Ulatowski.2 // Copyright (C) 1999-2019 Maciej Komosinski and Szymon Ulatowski. 3 3 // See LICENSE.txt for details. 4 4 … … 300 300 } 301 301 } 302 /* no break */302 [[fallthrough]]; 303 303 case '#': 304 304 { … … 522 522 break; 523 523 } 524 524 wait_link: 525 525 { 526 526 // wait for other neurons to develop … … 537 537 gcur = gcur->child; 538 538 } 539 539 break; 540 540 case ':': 541 541 { … … 1624 1624 if (root->child) 1625 1625 { 1626 char* buf = (char*)malloc(300);1627 DB(printf("(%d) ", root->child->count());)1628 buf[0] = 0;1629 root->child->sprintAdj(buf);1630 DB(printf("%s\n", buf);)1631 free(buf);1626 char* buf = (char*)malloc(300); 1627 DB(printf("(%d) ", root->child->count());) 1628 buf[0] = 0; 1629 root->child->sprintAdj(buf); 1630 DB(printf("%s\n", buf);) 1631 free(buf); 1632 1632 } 1633 1633 ) -
cpp/frams/genetics/fB/fB_oper.cpp
r821 r853 1 1 // This file is a part of Framsticks SDK. http://www.framsticks.com/ 2 // Copyright (C) 1999-201 8Maciej Komosinski and Szymon Ulatowski.2 // Copyright (C) 1999-2019 Maciej Komosinski and Szymon Ulatowski. 3 3 // See LICENSE.txt for details. 4 4 … … 301 301 } 302 302 } 303 /* no break */303 [[fallthrough]]; 304 304 case FB_INSERTION: 305 305 { … … 359 359 res.insert(res.end(), iters[3], tokenized.end()); 360 360 361 // SString first = line.substr(cuts[0], cuts[1] - cuts[0]);362 // SString second = line.substr(cuts[2], cuts[3] - cuts[2]);363 // SString result = line.substr(0, cuts[0]) + second +364 // line.substr(cuts[1], cuts[2] - cuts[1]) + first + line.substr(cuts[3]);361 // SString first = line.substr(cuts[0], cuts[1] - cuts[0]); 362 // SString second = line.substr(cuts[2], cuts[3] - cuts[2]); 363 // SString result = line.substr(0, cuts[0]) + second + 364 // line.substr(cuts[1], cuts[2] - cuts[1]) + first + line.substr(cuts[3]); 365 365 line = detokenizeSequence(&res); 366 366 chg = (float)(cuts[3] - cuts[2] + cuts[1] - cuts[0]) / line.len(); … … 420 420 break; 421 421 } 422 // case FB_CROSSING_OVER:423 // {424 // // iterate through all genes of the first parent and assign them425 // // randomly to children426 // for (int i = 0; i < fB_GenoHelpers::geneCount(parent1); i++)427 // {428 // int start, end;429 // SString gene = fB_GenoHelpers::getGene(i, parent1, start, end);430 // if (randomN(2) == 0)431 // {432 // child1 += gene;433 // chg1 += 1.0f;434 // }435 // else436 // {437 // child2 += gene;438 // }439 // }440 // chg1 /= fB_GenoHelpers::geneCount(parent1);441 //442 // // do the same with second parent443 // for (int i = 0; i < fB_GenoHelpers::geneCount(parent2); i++)444 // {445 // int start, end;446 // SString gene = fB_GenoHelpers::getGene(i, parent2, start, end);447 // if (randomN(2) == 0)448 // {449 // child1 += gene;450 // }451 // else452 // {453 // child2 += gene;454 // chg2 += 1.0f;455 // }456 // }457 // chg2 /= fB_GenoHelpers::geneCount(parent2);458 // break;459 // }422 // case FB_CROSSING_OVER: 423 // { 424 // // iterate through all genes of the first parent and assign them 425 // // randomly to children 426 // for (int i = 0; i < fB_GenoHelpers::geneCount(parent1); i++) 427 // { 428 // int start, end; 429 // SString gene = fB_GenoHelpers::getGene(i, parent1, start, end); 430 // if (randomN(2) == 0) 431 // { 432 // child1 += gene; 433 // chg1 += 1.0f; 434 // } 435 // else 436 // { 437 // child2 += gene; 438 // } 439 // } 440 // chg1 /= fB_GenoHelpers::geneCount(parent1); 441 // 442 // // do the same with second parent 443 // for (int i = 0; i < fB_GenoHelpers::geneCount(parent2); i++) 444 // { 445 // int start, end; 446 // SString gene = fB_GenoHelpers::getGene(i, parent2, start, end); 447 // if (randomN(2) == 0) 448 // { 449 // child1 += gene; 450 // } 451 // else 452 // { 453 // child2 += gene; 454 // chg2 += 1.0f; 455 // } 456 // } 457 // chg2 /= fB_GenoHelpers::geneCount(parent2); 458 // break; 459 // } 460 460 case FB_CROSSING_OVER: 461 461 { 462 462 // get maximal count of genes from both parents 463 463 int maxgenecount = max(fB_GenoHelpers::geneCountNoNested(parent1), 464 464 fB_GenoHelpers::geneCountNoNested(parent2)); 465 465 466 466 // while there are genes in at least one genotype … … 472 472 // if both parents have genes available, then distribute them 473 473 if (i < fB_GenoHelpers::geneCountNoNested(parent1) && 474 474 i < fB_GenoHelpers::geneCountNoNested(parent2)) 475 475 { 476 476 if (randomN(2) == 0) -
cpp/frams/genetics/fL/fL_oper.cpp
r821 r853 1 1 // This file is a part of Framsticks SDK. http://www.framsticks.com/ 2 // Copyright (C) 1999-201 8Maciej Komosinski and Szymon Ulatowski.2 // Copyright (C) 1999-2019 Maciej Komosinski and Szymon Ulatowski. 3 3 // See LICENSE.txt for details. 4 4 … … 313 313 // if there are no rules - create one 314 314 } 315 /* no break */315 [[fallthrough]]; 316 316 case FL_ADD_RULE: 317 317 { … … 387 387 // if there are no words, from which rules can be formed, then add one 388 388 } 389 /* no break */389 [[fallthrough]]; 390 390 case FL_ADD_WDEF: 391 391 { … … 411 411 // deletion should be performed 412 412 } 413 /* no break */413 [[fallthrough]]; 414 414 case FL_DEL_WORD: 415 415 { … … 476 476 // if no words available, then add word 477 477 } 478 /* no break */478 [[fallthrough]]; 479 479 case FL_ADD_WORD: 480 480 {
Note: See TracChangeset
for help on using the changeset viewer.