Example #1
0
        static void DrawResult(bool a, bool b, bool c)
        {
            bool res = Logic.EQUAL(Logic.OR(Logic.NOT(Logic.AND(Logic.NOT(a), b)), c), Logic.AND(Logic.NOT(b), c));

            Console.WriteLine($"|{res}\t");
            Console.WriteLine("----------------------------------------------");
        }
Example #2
0
    private void GetBreakDesire()
    {
        _breakDesire.GetFunction("Break").Fuzzy = (Logic.OR(Logic.OR(Logic.AND(_velocity.IS("Alta"), _distance.IS("Perto")), Logic.AND(_velocity.IS("Media"), _distance.IS("Perto"))), _distance.IS("Muito Perto")));

        _breakDesire.GetFunction("Dont").Fuzzy = (Logic.OR(_velocity.IS("Baixa"), _distance.IS("Longe")));

        float __defuzzy = _breakDesire.Defuzzyfication(0.01f);

        Debug.Log("Break: " + _breakDesire.GetFunction("Break").Fuzzy + " | Dont: " + _breakDesire.GetFunction("Dont").Fuzzy + " | Defuzzy: " + __defuzzy);

        if (_breakDesire.GetFunction("Break").Fuzzy >= 0.85f)
        {
            AccForce = -1 * (_breakDesire.GetFunction("Break").Fuzzy) + 0.12f;
        }
        else if (_breakDesire.GetFunction("Break").Fuzzy < 0.85f && _breakDesire.GetFunction("Dont").Fuzzy >= 0.2f)
        {
            AccForce = 1 * _breakDesire.GetFunction("Dont").Fuzzy + 0.25f;
        }
        else
        {
            AccForce = 1;
        }
        //float __percentage;
        //if (__defuzzy <= 0.2f)
        //{
        //    __percentage = 1 * (0.2f / __defuzzy);
        //    AccForce = -__percentage;
        //}
        //else
        //{
        //    __percentage = 1 * __defuzzy / 0.8f;
        //    AccForce = __percentage;
        //}
    }
Example #3
0
        static void DrawLine(bool a, bool b)
        {
            bool e = Logic.NOT(a);
            bool m = Logic.AND(a, b);
            bool c = Logic.OR(a, b);
            bool k = Logic.EQUAL(a, b);
            bool v = Logic.IMPL(a, b);
            bool g = Logic.XOR(a, b);

            Console.WriteLine($"|{a}\t|{b}\t|{e}\t|{m}\t\t|{c}\t\t|{k}\t\t|{v}\t\t|{g}\t\t|\n" +
                              "-----------------------------------------------------------------------------------------------------\t");
        }
Example #4
0
        static void DrawLine(bool a, bool b, bool c)
        {
            bool e  = Logic.NOT(a);
            bool m  = Logic.AND(e, b);
            bool nm = Logic.NOT(m);
            bool d  = Logic.OR(nm, c);
            bool nb = Logic.NOT(b);
            bool k  = Logic.AND(nb, c);

            Console.WriteLine($"|{a}\t|{b}\t|{c}\t|{e}\t|{m}\t\t|{nm}\t\t\t|{d}\t\t\t\t|{nb}\t|{k}\n" +
                              $"--------------------------------------------------------------------------------------------------------------------------------------------------------------\t");
        }