src/core/WeaponSystem.js
/**
	* Inits the fuzzy modules for all weapons.
	*
	* @return {WeaponSystem} A reference to this weapon system.
	*/
Inits the fuzzy modules for all weapons.
@return {WeaponSystem} A reference to this weapon system.
Inits the fuzzy modules for all weapons . @return { WeaponSystem } A reference to this weapon system .
_initFuzzyModules() {
		this.fuzzyModules.assaultRifle = new FuzzyModule();
		this.fuzzyModules.blaster = new FuzzyModule();
		this.fuzzyModules.shotGun = new FuzzyModule();
		const fuzzyModuleAssaultRifle = this.fuzzyModules.assaultRifle;
		const fuzzyModuleBlaster = this.fuzzyModules.blaster;
		const fuzzyModuleShotGun = this.fuzzyModules.shotGun;
		const distanceToTarget = new FuzzyVariable();
		const targetClose = new LeftShoulderFuzzySet( 0, 10, 20 );
		const targetMedium = new TriangularFuzzySet( 10, 20, 40 );
		const targetFar = new RightShoulderFuzzySet( 20, 40, 1000 );
		distanceToTarget.add( targetClose );
		distanceToTarget.add( targetMedium );
		distanceToTarget.add( targetFar );
		const desirability = new FuzzyVariable();
		const undesirable = new LeftShoulderFuzzySet( 0, 25, 50 );
		const desirable = new TriangularFuzzySet( 25, 50, 75 );
		const veryDesirable = new RightShoulderFuzzySet( 50, 75, 100 );
		desirability.add( undesirable );
		desirability.add( desirable );
		desirability.add( veryDesirable );
		fuzzyModuleAssaultRifle.addFLV( 'desirability', desirability );
		fuzzyModuleAssaultRifle.addFLV( 'distanceToTarget', distanceToTarget );
		fuzzyModuleBlaster.addFLV( 'desirability', desirability );
		fuzzyModuleBlaster.addFLV( 'distanceToTarget', distanceToTarget );
		fuzzyModuleShotGun.addFLV( 'desirability', desirability );
		fuzzyModuleShotGun.addFLV( 'distanceToTarget', distanceToTarget );
		const fuzzySets = {
			targetClose: targetClose,
			targetMedium: targetMedium,
			targetFar: targetFar,
			undesirable: undesirable,
			desirable: desirable,
			veryDesirable: veryDesirable
		};
		this._initAssaultRifleFuzzyModule( fuzzySets );
		this._initBlasterFuzzyModule( fuzzySets );
		this._initShotgunFuzzyModule( fuzzySets );
		return this;
	}
_initFuzzyModules ( ) { this . fuzzyModules . assaultRifle = new FuzzyModule ( ) ; this . fuzzyModules . blaster = new FuzzyModule ( ) ; this . fuzzyModules . shotGun = new FuzzyModule ( ) ; const fuzzyModuleAssaultRifle = this . fuzzyModules . assaultRifle ; const fuzzyModuleBlaster = this . fuzzyModules . blaster ; const fuzzyModuleShotGun = this . fuzzyModules . shotGun ; const distanceToTarget = new FuzzyVariable ( ) ; const targetClose = new LeftShoulderFuzzySet ( 0 , 10 , 20 ) ; const targetMedium = new TriangularFuzzySet ( 10 , 20 , 40 ) ; const targetFar = new RightShoulderFuzzySet ( 20 , 40 , 1000 ) ; distanceToTarget . add ( targetClose ) ; distanceToTarget . add ( targetMedium ) ; distanceToTarget . add ( targetFar ) ; const desirability = new FuzzyVariable ( ) ; const undesirable = new LeftShoulderFuzzySet ( 0 , 25 , 50 ) ; const desirable = new TriangularFuzzySet ( 25 , 50 , 75 ) ; const veryDesirable = new RightShoulderFuzzySet ( 50 , 75 , 100 ) ; desirability . add ( undesirable ) ; desirability . add ( desirable ) ; desirability . add ( veryDesirable ) ; fuzzyModuleAssaultRifle . addFLV ( 'desirability' , desirability ) ; fuzzyModuleAssaultRifle . addFLV ( 'distanceToTarget' , distanceToTarget ) ; fuzzyModuleBlaster . addFLV ( 'desirability' , desirability ) ; fuzzyModuleBlaster . addFLV ( 'distanceToTarget' , distanceToTarget ) ; fuzzyModuleShotGun . addFLV ( 'desirability' , desirability ) ; fuzzyModuleShotGun . addFLV ( 'distanceToTarget' , distanceToTarget ) ; const fuzzySets = { targetClose : targetClose , targetMedium : targetMedium , targetFar : targetFar , undesirable : undesirable , desirable : desirable , veryDesirable : veryDesirable } ; this . _initAssaultRifleFuzzyModule ( fuzzySets ) ; this . _initBlasterFuzzyModule ( fuzzySets ) ; this . _initShotgunFuzzyModule ( fuzzySets ) ; return this ; }
Inits the fuzzy modules for all weapons.
Inits the fuzzy modules for all weapons .
// the following FLVs are equal for all modules // FLV distance to target // FLV desirability // //