public static void Main()
Console.WriteLine("Enter state for node A. Value should 1 or 0.");
double valueA = int.Parse(Console.ReadLine());
Console.WriteLine("Enter state for node B. Value should 1 or 0.");
double valueB = int.Parse(Console.ReadLine());
Console.WriteLine("Select Mode to apply the data against: 1 = AND 2 = XOR 3 = OR");
double mode = int.Parse(Console.ReadLine());
double thresholdValue = 2;
OR(valueA, valueB, thresholdValue, OrBiasValue);
AND(valueA, valueB, thresholdValue, AndBiasValue);
static public double Threshold(double thresholdValue, double weight1, double node1Value, double weight2, double node2Value)
return Threshold(thresholdValue, weight1, node1Value, weight2, node2Value, 0);
static public double Threshold(double thresholdValue, double weight1, double node1Value, double weight2, double node2Value, double biasValue)
double firstValues = weight1 * node1Value;
double secondValues = weight2 * node2Value;
double result = firstValues + secondValues;
if(result >= thresholdValue)
static public void AND(double value1, double value2, double thresholdValue, double biasValue)
double output = Threshold(thresholdValue, weight, value1, weight, value2, biasValue);
Console.WriteLine("The two numbers were the same");
Console.WriteLine("The numbers were different");
static public void OR(double value1, double value2, double thresholdValue, double biasValue)
double output = Threshold(thresholdValue, weight, value1, weight, value2, biasValue );
Console.WriteLine("The two numbers were the same");
Console.WriteLine("The numbers were different");
static public void XOR(double valueA, double valueB)
double weightMinus1 = -1;
double output = Threshold(tValue, weight1, valueA,weight1, valueB);
double output1 = Threshold(tValue, weight1, valueA,weight1, valueB);
double output3 = Threshold(tValue, weightMinus1, output1,weight1, output);
Console.WriteLine("XOR 1 was one of the values");
Console.WriteLine("1 wasnt one of the values or it was used twice.");