public void FuzzyTowerCalcSniper(FuzzyModule towerFuzzyModule) { // Retrieves the antecedents. FuzzyVariable health = towerFuzzyModule.GetVar("Health"); FzSet low = new FzSet(health.GetSet("Low")); FzSet middle = new FzSet(health.GetSet("Middle")); FzSet high = new FzSet(health.GetSet("High")); FuzzyVariable distanceToEnemy = towerFuzzyModule.GetVar("DistanceToEnemy"); FzSet close = new FzSet(distanceToEnemy.GetSet("Close")); FzSet medium = new FzSet(distanceToEnemy.GetSet("Medium")); FzSet far = new FzSet(distanceToEnemy.GetSet("Far")); // Creates the consequent. FuzzyVariable shootDesirability = towerFuzzyModule.CreateFLV("ShootDesirability"); FzSet undesirable = shootDesirability.AddLeftShoulderSet("Undesirable", 0, 15, 30); FzSet desirable = shootDesirability.AddTriangularSet("Desirable", 15, 30, 75); FzSet veryDesirable = shootDesirability.AddRightShoulderSet("VeryDesirable", 30, 75, 100); // Add rules to complete the FAM. towerFuzzyModule.AddRule(new FzAND(low, close), desirable); towerFuzzyModule.AddRule(new FzAND(low, medium), desirable); towerFuzzyModule.AddRule(new FzAND(low, far), veryDesirable); towerFuzzyModule.AddRule(new FzAND(middle, close), undesirable); towerFuzzyModule.AddRule(new FzAND(middle, medium), undesirable); towerFuzzyModule.AddRule(new FzAND(middle, far), desirable); towerFuzzyModule.AddRule(new FzAND(high, close), undesirable); towerFuzzyModule.AddRule(new FzAND(high, medium), undesirable); towerFuzzyModule.AddRule(new FzAND(high, far), desirable); }