Changeset 1299 for cpp/frams/genetics/fH/fH_oper.cpp
- Timestamp:
- 03/29/24 23:34:00 (13 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
cpp/frams/genetics/fH/fH_oper.cpp
r1273 r1299 237 237 238 238 // used for computing chg 239 unsigned int sumgenes = creature->sticks.size() + creature->neurons.size() + creature->connections.size();239 size_t sumgenes = creature->sticks.size() + creature->neurons.size() + creature->connections.size(); 240 240 241 241 // if there is only one element in genotype (stick), then deletion would end … … 401 401 unsigned int Geno_fH::getRandomHandle(fH_Builder *creature, fH_Handle *&handle, ParamEntry *&tab, bool skipalonestick) 402 402 { 403 unsigned int allhandlescount = creature->connections.size() + creature->neurons.size();403 size_t allhandlescount = creature->connections.size() + creature->neurons.size(); 404 404 if (!skipalonestick || creature->sticks.size() > 1) 405 405 { 406 406 allhandlescount += creature->sticks.size(); 407 407 } 408 unsignedint toselect = rndUint(allhandlescount);409 if ( toselect < creature->connections.size())408 int toselect = rndUint(allhandlescount); 409 if ((size_t)toselect < creature->connections.size()) 410 410 { 411 411 handle = creature->connections[toselect]; … … 413 413 return toselect; 414 414 } 415 else if (toselect - creature->connections.size() <creature->neurons.size())416 { 417 toselect -= creature->connections.size();415 else if (toselect - (int)creature->connections.size() < (int)creature->neurons.size()) 416 { 417 toselect -= (int)creature->connections.size(); 418 418 handle = creature->neurons[toselect]; 419 419 tab = creature->neuronparamtab; 420 if (toselect < 0) 421 logMessage("Geno_fH", "getRandomHandle", LOG_CRITICAL, "toselect<0"); 420 422 return toselect; 421 423 } 422 toselect -= creature->connections.size() + creature->neurons.size();424 toselect -= int(creature->connections.size() + creature->neurons.size()); 423 425 handle = creature->sticks[toselect]; 424 426 tab = creature->stickparamtab; 427 if (toselect < 0) 428 logMessage("Geno_fH", "getRandomHandle", LOG_CRITICAL, "toselect<0"); 425 429 return toselect; 426 430 }
Note: See TracChangeset
for help on using the changeset viewer.