Changeset 1316 for cpp/frams


Ignore:
Timestamp:
07/11/24 17:38:44 (4 months ago)
Author:
Maciej Komosinski
Message:

Fixed the reported fraction of parent1 and parent2 genes in the child, when the second child is chosen (the fractions were previously swapped in this case, i.e, they did not match the order of parent names)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • cpp/frams/genetics/genman.cpp

    r1273 r1316  
    11// This file is a part of Framsticks SDK.  http://www.framsticks.com/
    2 // Copyright (C) 1999-2020  Maciej Komosinski and Szymon Ulatowski.
     2// Copyright (C) 1999-2024  Maciej Komosinski and Szymon Ulatowski.
    33// See LICENSE.txt for details.
    44
     
    370370        }
    371371
    372         float chg;
     372        float chg; //fraction of parent1 genes in the child
    373373        bool ok = false;
    374374        int pcount = count;
     
    385385                        if (g1n[0] && g2n[0]) if (rndUint(2) == 0) g1n[0] = 0; else g2n[0] = 0; //both provided? we want only one
    386386                        if (g1n[0]) { gn = g1n; chg = chg1; }
    387                         else { gn = g2n; chg = chg2; }
     387                        else { gn = g2n; chg = 1 - chg2; }
    388388                        LoggerToMemory eh(LoggerBase::Enable | LoggerToMemory::StoreFirstMessage); //mute testValidity()
    389389                        Geno G(gn, g1v.getFormat(), "", "");
Note: See TracChangeset for help on using the changeset viewer.