/// <summary>
        /// Sets up the Throttle Fuzzy Sets for the Throttle FuzzyCollection
        /// </summary>
        private void SetThrottleSets()
        {
            #region Throttle Set Definition - T_None, T_Soft, T_Medium, T_Hard

                ThrottleSets = new FuzzyCollection("Throttle Sets", null);

                ThrottleSets.Add("T_None", new FuzzySet());
                ThrottleSets["T_None"] = new FuzzySet("T_None", 0, 100);
                ThrottleSets["T_None"].LineColour = new SolidBrush(Color.Gray);
                ThrottleSets["T_None"].AddPoint(0, 1, false, false);
                ThrottleSets["T_None"].AddPoint(8, 0, false, false);
                ThrottleSets["T_None"].AddPoint(100, 0, false, false);

                #endregion
        }
Example #2
0
        private VirtualKeyCode ToVK(string key)
        {
            VirtualKeyCode result;
            if(Enum.TryParse<VirtualKeyCode>(key, out result))
                return result;
            if(Aliases.TryGetValue(key.ToLowerInvariant(), out result))
                return result;

            FuzzyCollection<string> acceptedValues = new FuzzyCollection<string>(Metrics.LevenshteinDistance);
            foreach(var val in Enum.GetNames(typeof(VirtualKeyCode)).Concat(Aliases.Select(kv => kv.Key)).Select(a => a.ToUpperInvariant()))
            {
                acceptedValues.Add(val);
            }
            var closest = acceptedValues.GetClosest(key.ToUpperInvariant()).First();
            throw new InterpreterException(key + " is not a valid parameter, do you mean " + closest.Value + " ? (valid values are : \""+ Print(key, acceptedValues)+"\" )");
        }
        /// <summary>
        /// Sets up the ThrottleOutput (Accumulator) Fuzzy Sets for the ThrottleOutput FuzzyCollection
        /// </summary>
        private void SetThrottleOutputSet()
        {
            ThrottleOutputs = new FuzzyCollection("Throttle Result", null);

                ThrottleOutputs.Add("ThrottleResult", new FuzzySet("ThrottleResult", 0, 100));
                ThrottleOutputs["ThrottleResult"].LineColour = new SolidBrush(Color.Black);
                ThrottleOutputs["ThrottleResult"].AddPoint(0, 0, false, false);
                ThrottleOutputs["ThrottleResult"].AddPoint(100, 0, false, false);
        }
        /// <summary>
        /// Initializes and sets up Rule Sets
        /// </summary>
        private void SetupRuleSets()
        {
            RuleSetThrottle = new FuzzyCollection("Throttle Rules", null);
            RuleSetThrustVec = new FuzzyCollection("Thrust Vector Rules", null);

            // Changes these as you add rules....
            int tRules = 21;
            int tvRules = 25;

            for (int i = 0; i < tRules; i++)
            {
                RuleSetThrottle.Add(new FuzzySet("Rule" + i.ToString(), 0, 120) { LineColour = ruleColours[i] });
                RuleSetThrottle["Rule" + i.ToString()].SetRangeWithPoints(0, 120);
            }

            for (int i = 0; i < tvRules; i++)
            {
                RuleSetThrustVec.Add(new FuzzySet("Rule" + i.ToString(), 0, 100) { LineColour = ruleColours[i] });
                RuleSetThrustVec["Rule" + i.ToString()].SetRangeWithPoints(-5, 5);
            }
        }