예제 #1
0
void JoinedLandscape::SubFromDistribution( string & itsConfig )
{
	unsigned short int strLength = itsConfig.length() / 2;
	d[itsConfig].SubFromDist();
	string first = itsConfig;
	first.replace ( strLength, strLength*2, strLength, '0' );
	string second = itsConfig;
	second.replace ( 0, strLength, strLength, '0' );
	LOne.SubFromDistribution(first);
	LTwo.SubFromDistribution(second);
}
예제 #2
0
bool Entity::Move( string destination, Landscape & LJoined )
{
	if ( destination == "EMPTY" ) { return 0; }
	string previous = itsPayoff.GetConfig();
	LJoined.SubFromDistribution( previous );
	// cout << "Move from " << itsPayoff.GetConfig() << ":" << itsPayoff.GetFitness() << " to ";
	itsPayoff.SetConfig( destination );
	itsPayoff.SetFitness( LJoined.d[destination].GetFitness() ) ;
	// cout << "to " << itsPayoff.GetConfig() << ":" << itsPayoff.GetFitness() << endl;
	LJoined.AddToDistribution( destination );
	movesTaken++;
	return 1;
}