예제 #1
0
 public void implicantTest()
 {
     BooleanAlgebra.Implicant imp1 = new BooleanAlgebra.Implicant(0, 5);
     BooleanAlgebra.Implicant imp2 = new BooleanAlgebra.Implicant(1, 5);
     BooleanAlgebra.Implicant imp3 = new BooleanAlgebra.Implicant(8, 5);
     BooleanAlgebra.Implicant imp4 = new BooleanAlgebra.Implicant(9, 5);
     System.Console.WriteLine($"{BooleanAlgebra.Implicant.CanCombine(imp1, imp2)}"); // true
     System.Console.WriteLine($"{BooleanAlgebra.Implicant.CanCombine(imp1, imp3)}"); // false
     BooleanAlgebra.Implicant imp1_2 = BooleanAlgebra.Implicant.Combine(imp1, imp2);
     Console.WriteLine($"{imp1_2.numOnes}");
     BooleanAlgebra.Implicant imp3_4 = BooleanAlgebra.Implicant.Combine(imp3, imp4);
     Console.WriteLine(imp1_2.ToString());
     Console.WriteLine(imp1_2.ToExpression());
     Console.WriteLine(imp3_4.ToString());
     Console.WriteLine(imp3_4.ToExpression());
     Console.WriteLine($"{BooleanAlgebra.Implicant.CanCombine(imp1_2, imp3_4)}");
     BooleanAlgebra.Implicant imp5 = BooleanAlgebra.Implicant.Combine(imp1_2, imp3_4);
     Console.WriteLine(imp5.ToString());
     Console.WriteLine(imp5.ToExpression());
 }
예제 #2
0
        public static void implicantTest()
        {
            Implicant imp1 = new Implicant(0, 5);
            Implicant imp2 = new Implicant(1, 5);
            Implicant imp3 = new Implicant(8, 5);
            Implicant imp4 = new Implicant(9, 5);

            System.Console.WriteLine($"{Implicant.CanCombine(imp1, imp2)}"); // true
            System.Console.WriteLine($"{Implicant.CanCombine(imp1, imp3)}"); // false
            Implicant imp1_2 = Implicant.Combine(imp1, imp2);

            Console.WriteLine($"{imp1_2.numOnes}");
            Implicant imp3_4 = Implicant.Combine(imp3, imp4);

            Console.WriteLine(imp1_2.ToString());
            Console.WriteLine(imp3_4.ToString());
            Console.WriteLine($"{Implicant.CanCombine(imp1_2, imp3_4)}");
            Implicant imp5 = Implicant.Combine(imp1_2, imp3_4);

            Console.WriteLine(imp5.ToString());
        }