pkgsrc/games/xarchon/patches/patch-an
2011-11-27 19:42:25 +00:00

43 lines
1.4 KiB
Text

$NetBSD: patch-an,v 1.2 2011/11/27 19:42:25 joerg Exp $
--- src/Genetic.hpp.orig 2002-01-09 18:34:33.000000000 +0000
+++ src/Genetic.hpp
@@ -1,6 +1,7 @@
#ifndef GENETIC_HPP
#define GENETIC_HPP
+#include <cstdlib>
#include <list>
using namespace std;
@@ -216,9 +217,9 @@ public:
virtual Genetic_Operator<T> *Choose_Operator(void)
{
int max=(int)total_op_weight;
- list<Genetic_Operator<T> *>::iterator start=operators.begin();
- list<Genetic_Operator<T> *>::iterator end=operators.end();
- list<Genetic_Operator<T> *>::iterator iter;
+ typename list<Genetic_Operator<T> *>::iterator start=operators.begin();
+ typename list<Genetic_Operator<T> *>::iterator end=operators.end();
+ typename list<Genetic_Operator<T> *>::iterator iter;
int r=rand()%max;
int count=0;
for (iter=start;iter!=end;iter++) {
@@ -249,7 +250,7 @@ public:
Genetic_Population<T> *newpop=new Genetic_Population<T>(p->size);
int cur_size=0;
while (cur_size<newpop->size) {
- Genetic_Operator<T> *op=Choose_Operator();
+ Genetic_Operator<T> *op=this->Choose_Operator();
if ( (cur_size+op->NumOfResults())>newpop->size)
continue;
for (i=0;i<op->NumOfOperands();i++) {
@@ -264,7 +265,7 @@ public:
cur_size++;
}
}
- newpop->Eval_Fitness(fit_func);
+ newpop->Eval_Fitness(this->fit_func);
return newpop;
}