#include "ProblemDomain.h"
#include <limits>

const FloatType ProblemDomain::POSITIVE_INFINITY = std::numeric_limits<FloatType>::infinity();
const FloatType ProblemDomain::NEGATIVE_INFINITY = -std::numeric_limits<FloatType>::infinity();

ProblemDomain::TournamentReturn ProblemDomain::tournament ( AlleleType *phenotypeLeft, AlleleType *phenotypeRight ) const {
  FloatType fitnessLeft = getFitness( phenotypeLeft );
  FloatType fitnessRight = getFitness( phenotypeRight );
  if ( fitnessLeft < fitnessRight )
    return TournamentReturn(TournamentReturn::RIGHT, fitnessRight);
  else if ( fitnessLeft > fitnessRight )
		return TournamentReturn(TournamentReturn::LEFT, fitnessLeft);
  else
		return TournamentReturn(TournamentReturn::TIE, NEGATIVE_INFINITY);
}
