private void updateGate(String A, String B, String G, String Y0, String Y1, String Y2, String Y3) throws InvalidPinException {
		if (this.isHigh(G)) {
			this.resetGate(Y0, Y1, Y2, Y3);
		} else {
			int count = 0;
			if (this.isHigh(B)) {
				count += 2;
			} else if (this.isHigh(A)) {
				count += 1;
			}
			switch (count) {
				case 0:
					this.setPin(Y0, Pin.PinState.LOW);
					this.setPin(Y1, Pin.PinState.HIGH);
					this.setPin(Y2, Pin.PinState.HIGH);
					this.setPin(Y3, Pin.PinState.HIGH);
					break;
				case 1:
					this.setPin(Y0, Pin.PinState.HIGH);
					this.setPin(Y1, Pin.PinState.LOW);
					this.setPin(Y2, Pin.PinState.HIGH);
					this.setPin(Y3, Pin.PinState.HIGH);
					break;
				case 2:
					this.setPin(Y0, Pin.PinState.HIGH);
					this.setPin(Y1, Pin.PinState.HIGH);
					this.setPin(Y2, Pin.PinState.LOW);
					this.setPin(Y3, Pin.PinState.HIGH);
					break;
				case 3:
					this.setPin(Y0, Pin.PinState.HIGH);
					this.setPin(Y1, Pin.PinState.HIGH);
					this.setPin(Y2, Pin.PinState.HIGH);
					this.setPin(Y3, Pin.PinState.LOW);
					break;
				default:
					this.resetGate(Y0, Y1, Y2, Y3);
			}
		}
	}