From 190d227a97f5729e59f5aa407dfa19b2f9976d4d Mon Sep 17 00:00:00 2001 From: Joel Beckmeyer Date: Mon, 10 Apr 2017 19:49:35 -0400 Subject: [PATCH] add simple evaluation to andGate --- src/andGate.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/andGate.cpp b/src/andGate.cpp index 9984fea..8451172 100644 --- a/src/andGate.cpp +++ b/src/andGate.cpp @@ -6,6 +6,9 @@ andGate::andGate(wire* wire1 = nullptr, wire* wire2 = nullptr, wire* wire3 = nullptr) : in1(wire1), in2(wire2), out(wire3) {} int andGate::evaluate(int evTime) { - int bool1 = in1 -> getValue(); - return ( in1 -> getValue(evTime) ) && ( in2 -> getValue(evTime) ); + int val1 = in1->getValue(); + int val2 = in2->getValue(); + if(val1 != -1 && val2 != -1) { + return val1 && val2; + } }