static void Main(string[] args) { uint[] outputIntegers = KaterynaBodnarchukTask.KateBodnarchukCase; bool[] output = BitTools.GetOutputBool(outputIntegers); List <Implicant> constituents = PositiveMcCluskeyMethod.GetConstituents(output); string constituentsDisjunctionFormString = Implicant.GetDisjunctionFormString(constituents); Console.WriteLine("Original Function: " + constituentsDisjunctionFormString); var minimalDisjunctionalNormalFunction = PositiveMcCluskeyMethod.GetImplicantDisjunctionNormalForm(output); Console.WriteLine( "Optimized Function: " + Implicant.GetDisjunctionFormString(minimalDisjunctionalNormalFunction) ); uint input = uint.Parse(Console.ReadLine()); Console.WriteLine( "Output: " + ImplicantDisjunctionNormalForm.Evaluate( minimalDisjunctionalNormalFunction, input ) ); Console.ReadKey(); }
public void TestMethod1() { uint[] outputIntegers = KaterynaBodnarchukTask.YouTubeCase; bool[] output = BitTools.GetOutputBool(outputIntegers); Func <uint, bool> perfectDisjunctionNormalFunction = new PerfectDisjunctionNormalFormBinary(output).Evaluate; Func <uint, bool> minimalDisjunctionalNormalFunction = value => ImplicantDisjunctionNormalForm.Evaluate( PositiveMcCluskeyMethod.GetImplicantDisjunctionNormalForm(output), value ); for (uint i = 0; i < BitTools.rowsCount; i++) { bool actual = output[i]; Assert.AreEqual(actual, perfectDisjunctionNormalFunction(i)); Assert.AreEqual(actual, minimalDisjunctionalNormalFunction(i)); } }