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)); }
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)); }
public static bool[] Logic(bool inD, bool inX) { bool NotX = NotG.Logic(inX); bool D_and_NotX = AndG.Logic(inD, NotX); bool D_and_X = AndG.Logic(inD, inX); bool[] outBool = new bool[2]; outBool[0] = D_and_NotX; outBool[1] = D_and_X; return(outBool); }
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] = AndG.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 = AndG.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; }