The Roulette wheel was broke lol

This commit is contained in:
Mike 2018-04-14 05:36:17 -07:00
parent a233802f6c
commit dc75f730ab
2 changed files with 13 additions and 1 deletions

View File

@ -534,6 +534,10 @@ namespace BitEvolver
mama = this->roulette_wheel->Spin();
papa = this->roulette_wheel->Spin();
//
//cout << "Roulette Wheel (mama): " << mama->ToString() << endl;
//cout << "Roulette Wheel (papa): " << papa->ToString() << endl;
//
kiddo = this->breeder->Breed(
mama, papa,

View File

@ -12,11 +12,16 @@
#include <mutex>
#include <algorithm>
#include <memory>
#include <iostream>
//
namespace BitEvolver
{
//
using std::cout;
using std::endl;
//
RouletteWheel::RouletteWheel()
{
@ -115,7 +120,7 @@ namespace BitEvolver
// Find the corresponding chromosome
for ( i=0; i<this->wheel_slots.size(); i++ ) {
if ( this->wheel_slots[i].first <= spin ) {
if ( this->wheel_slots[i].first >= spin ) {
return this->wheel_slots[i].second;
}
}
@ -172,6 +177,9 @@ namespace BitEvolver
//
pairs.push_back(pair);
//
//cout << "[" << pair.first << "]" << chromosome->ToString() << endl;
}
return pairs;