Changeset 1130 for cpp/frams/_demos


Ignore:
Timestamp:
04/16/21 15:55:34 (3 years ago)
Author:
Maciej Komosinski
Message:

Used std::min(), std::max() explicitly to avoid compiler confusion. Used std::size() explicitly instead of the equivalent macro

Location:
cpp/frams/_demos
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • cpp/frams/_demos/evol_test.cpp

    r1031 r1130  
    11// This file is a part of Framsticks SDK.  http://www.framsticks.com/
    2 // Copyright (C) 2019-2020  Maciej Komosinski and Szymon Ulatowski.
     2// Copyright (C) 2019-2021  Maciej Komosinski and Szymon Ulatowski.
    33// See LICENSE.txt for details.
    44
     
    195195        for (int i = 0; i < nr_evals; i++)
    196196        {
    197                 int selected_positive = tournament(population, max(2, int(sqrt(population.size()) / 2))); //moderate positive selection pressure
     197                int selected_positive = tournament(population, std::max(2, int(sqrt(population.size()) / 2))); //moderate positive selection pressure
    198198                int selected_negative = rndUint(population.size()); //random negative selection
    199199
     
    214214                else
    215215                {
    216                         int selected_positive2 = tournament(population, max(2, int(sqrt(population.size()) / 2)));
     216                        int selected_positive2 = tournament(population, std::max(2, int(sqrt(population.size()) / 2)));
    217217                        Geno xover = genman.crossOver(population[selected_positive].geno, population[selected_positive2].geno);
    218218                        if (xover.getGenes() == "")
  • cpp/frams/_demos/printconvmap.cpp

    r973 r1130  
    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-2021  Maciej Komosinski and Szymon Ulatowski.
    33// See LICENSE.txt for details.
    44
     
    8888        :model(m)
    8989{
    90         joint_offset = max(10, (int(9 + model.getPartCount()) / 10) * 10);
    91         neuron_offset = joint_offset + max(10, (int(9 + model.getJointCount()) / 10) * 10);
    92         max_element = neuron_offset + max(10, (int(9 + model.getNeuroCount()) / 10) * 10);
     90        joint_offset = std::max(10, (int(9 + model.getPartCount()) / 10) * 10);
     91        neuron_offset = joint_offset + std::max(10, (int(9 + model.getJointCount()) / 10) * 10);
     92        max_element = neuron_offset + std::max(10, (int(9 + model.getNeuroCount()) / 10) * 10);
    9393        for (int i = 0; i < model.getPartCount(); i++)
    9494                map.add(Model::partToMap(i), Model::partToMap(i), i, i);
Note: See TracChangeset for help on using the changeset viewer.