Changeset 935 for cpp/frams/genetics/fH/fH_oper.cpp
- Timestamp:
- 05/29/20 15:20:29 (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
cpp/frams/genetics/fH/fH_oper.cpp
r896 r935 1 1 // This file is a part of Framsticks SDK. http://www.framsticks.com/ 2 // Copyright (C) 1999-20 18Maciej Komosinski and Szymon Ulatowski.2 // Copyright (C) 1999-2020 Maciej Komosinski and Szymon Ulatowski. 3 3 // See LICENSE.txt for details. 4 4 … … 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 if (getActiveNeuroClassCount(Model::SHAPE_BALL_AND_STICK) == 0) method = FH_OPCOUNT + FH_ADD_STICK; 258 258 switch (method - FH_OPCOUNT) 259 259 { … … 466 466 if (userandomclass) 467 467 { 468 nc = getRandomNeuroClass( );468 nc = getRandomNeuroClass(Model::SHAPE_BALL_AND_STICK); 469 469 // checking of neuron class availability should be checked before 470 470 } … … 503 503 uint32_t Geno_fH::style(const char *g, int pos) 504 504 { 505 char ch=g[pos]; 506 uint32_t style=GENSTYLE_CS(0,GENSTYLE_NONE); //default, should be changed below 507 508 int pp=pos; //detect comment line 509 while (pp>1 && g[pp-1]!='\n') pp--; 510 if (g[pp]=='#') return GENSTYLE_RGBS(0,220,0,GENSTYLE_NONE); //comment line 511 512 if (pos==0 || g[pos-1]=='\n' || ch==':' || ch==',') style=GENSTYLE_CS(0,GENSTYLE_BOLD); else 513 if (ch=='\"') style=GENSTYLE_RGBS(150,0,0,GENSTYLE_BOLD); else 514 { 515 int cudz=0,neuclass=1; //ile cudz. do poczatku linii; czy w nazwie neuroklasy? 516 while (pos>0) 517 { 518 pos--; 519 if (g[pos]=='\"') cudz++; 520 if (cudz==0 && (g[pos]==':' || g[pos]==',')) neuclass=0; 521 if (g[pos]=='\n') break; 522 } 523 if (cudz%2) 524 { 525 if (neuclass) style=GENSTYLE_RGBS(150,0,150,GENSTYLE_BOLD); else //neuroclass 526 if (isalpha(ch)) style=GENSTYLE_RGBS(255,140,0,GENSTYLE_BOLD); else //property 527 style=GENSTYLE_RGBS(200,0,0,GENSTYLE_NONE); 528 } else 529 if (isalpha(ch)) style=GENSTYLE_RGBS(0,0,200,GENSTYLE_BOLD); 530 } 531 return style; 532 } 505 char ch = g[pos]; 506 uint32_t style = GENSTYLE_CS(0, GENSTYLE_NONE); //default, should be changed below 507 508 int pp = pos; //detect comment line 509 while (pp > 1 && g[pp - 1] != '\n') pp--; 510 if (g[pp] == '#') return GENSTYLE_RGBS(0, 220, 0, GENSTYLE_NONE); //comment line 511 512 if (pos == 0 || g[pos - 1] == '\n' || ch == ':' || ch == ',') style = GENSTYLE_CS(0, GENSTYLE_BOLD); else 513 if (ch == '\"') style = GENSTYLE_RGBS(150, 0, 0, GENSTYLE_BOLD); else 514 { 515 int cudz = 0, neuclass = 1; //ile cudz. do poczatku linii; czy w nazwie neuroklasy? 516 while (pos > 0) 517 { 518 pos--; 519 if (g[pos] == '\"') cudz++; 520 if (cudz == 0 && (g[pos] == ':' || g[pos] == ',')) neuclass = 0; 521 if (g[pos] == '\n') break; 522 } 523 if (cudz % 2) 524 { 525 if (neuclass) style = GENSTYLE_RGBS(150, 0, 150, GENSTYLE_BOLD); else //neuroclass 526 if (isalpha(ch)) style = GENSTYLE_RGBS(255, 140, 0, GENSTYLE_BOLD); else //property 527 style = GENSTYLE_RGBS(200, 0, 0, GENSTYLE_NONE); 528 } 529 else 530 if (isalpha(ch)) style = GENSTYLE_RGBS(0, 0, 200, GENSTYLE_BOLD); 531 } 532 return style; 533 }
Note: See TracChangeset
for help on using the changeset viewer.