#include "FarZone.h"
#include "DebugAI.h"

FarZone::FarZone(void){
	name = FAR_ZONE;
	begin = 1;
	end = 10;
}

FarZone::~FarZone(void)
{
}

FarZone::FarZone(Distance* aFuzzyNumber){
	fuzzyNumber = aFuzzyNumber;
	fuzzyNumber->addFV(this);
	name = FAR_ZONE;
	begin = 1;
	end = 10;
}

void FarZone::update(){
	if (this->getFuzzyNumberValue()>= 0 && this->getFuzzyNumberValue()<begin){
		setValue(0);
	}
	if (this->getFuzzyNumberValue()>= end ){
		setValue(1);
	}
	if (this->getFuzzyNumberValue()<0){
		//If the execution go here they must have a problem.
		setValue(-1);
	}
	if (this->getFuzzyNumberValue()>= begin && this->getFuzzyNumberValue()<end){
		setValue((this->getFuzzyNumberValue() * (1/(end-begin))) - (begin/(end-begin)));
	}
	DebugAI::trace('v', toString());
}