Exemple #1
0
    public static bool Logic(bool inA, bool inB, bool inX)
    {
        bool NotX       = NotG.Logic(inX);
        bool A_and_NotX = AndG.Logic(inA, NotX);
        bool B_and_X    = AndG.Logic(inB, inX);

        return(OrG.Logic(A_and_NotX, B_and_X));
    }
Exemple #2
0
    public static bool Logic(bool inA, bool inB)
    {
        bool notA      = NotG.Logic(inA);
        bool notB      = NotG.Logic(inB);
        bool AAnd_NotB = AndG.Logic(inA, notB);
        bool BAnd_NotA = AndG.Logic(inB, notA);

        return(OrG.Logic(AAnd_NotB, BAnd_NotA));
    }
Exemple #3
0
 public static bool[] Logic(bool[] inA, bool[] inB)
 {
     if (inA.Length != 16 || inB.Length != 16)
     {
         Debug.Log("Wrong input to Not16");
         Application.Quit();
     }
     bool[] output = new bool[16];
     for (int i = 0; i < 16; i++)
     {
         output[i] = OrG.Logic(inA[i], inB[i]);
     }
     return(output);
 }
    void Update()
    {
        if (isSimulating && timeCounter >= timeP)
        {
            bool valueA = false;
            bool valueB = false;

            if (counter == 0)
            {
                valueA = false;
                valueB = false;
            }
            else if (counter == 1)
            {
                valueA = false;
                valueB = true;
            }
            else if (counter == 2)
            {
                valueA = true;
                valueB = false;
            }
            else if (counter == 3)
            {
                valueA = true;
                valueB = true;
            }

            inputA.material = valueA ? onMat : offMat;
            inputB.material = valueB ? onMat : offMat;
            bool outp = OrG.Logic(valueA, valueB);
            //Debug.Log("inputA " + valueA + " inputB " + valueB + " output " + outp);
            output.material = outp ? onMat : offMat;

            counter++;

            if (counter >= 4)
            {
                counter = 0;
            }

            timeCounter = 0.0f;
        }
        timeCounter += Time.deltaTime;
    }
Exemple #5
0
 public static bool Logic(bool[] inA)
 {
     if (inA.Length != 8)
     {
         Debug.Log("Wrong input to Not16");
         Application.Quit();
     }
     bool[] output1 = new bool[4];
     for (int i = 0; i < 8; i = i + 2)
     {
         output1[i / 2] = OrG.Logic(inA[i], inA[i + 1]);
     }
     bool[] output2 = new bool[2];
     for (int i = 0; i < 4; i = i + 2)
     {
         output2[i / 2] = OrG.Logic(output1[i], output1[i + 1]);
     }
     return(OrG.Logic(output2[0], output2[1]));
 }