Пример #1
0
        private void newKmap()
        {
            Console.Write("From an expression or from minterms \n> ");
            String userInput = "";

            do
            {
                userInput = Console.ReadLine();
                if (userInput.Equals("expression"))
                {
                    String expression = getExpression();
                    if (expression.Equals(""))
                    {
                        break;
                    }
                    else
                    {
                        BooleanExpression tempExpression = new BooleanExpression(expression);
                        currentObject = new KarnaughMap(tempExpression);
                        break;
                    }
                }
                else if (userInput.Equals("minterms"))
                {
                    Console.WriteLine("Please enter how many variables are in this kmap (2-5)");
                    int numVariables = getNumber();
                    currentObject = new KarnaughMap(getMintermlist(), numVariables);
                    break;
                }
                else
                {
                    Console.WriteLine("Invalid Input, type 'expression', 'minterm' or 'cancel'");
                }
            } while (!userInput.Equals("cancel"));
        }
Пример #2
0
        public void MintermsFromKmap()
        {
            BooleanExpression expression1 = new BooleanExpression("a'b'cd + a'bc'd");
            var kmap1 = new KarnaughMap(expression1);

            Console.WriteLine(kmap1.MintermString());
        }
Пример #3
0
        public void KmapFromMinterms()
        {
            int[]       mintermArray = new[] { 1, 2, 3, 4, 8, 9, 0, 4, 5, 10 };
            List <int>  mintermList  = new List <int>(mintermArray);
            KarnaughMap kmap1        = new KarnaughMap(mintermList, 4);

            Console.WriteLine(kmap1.ToString());
            Console.WriteLine(mintermList.ToString());
        }
Пример #4
0
        public void CreateKMap()
        {
            //BooleanExpression expression1 = new BooleanExpression("a'*b'*c*d+a'*b*c'*e+a*b'*c'*e'+a'*b*c*d'+a*b'*c*e+a*c'*d'*e+a*c*d'*e'");
            BooleanExpression expression1 = new BooleanExpression("b'*d' +a'*d + c'*d");
            BooleanExpression expression2 = new BooleanExpression("a'b'cd + a'bc'e + ab'c'e' + a'bcd' + ab'ce + ac'd'e + acd'e'");
            KarnaughMap       kmap1       = new KarnaughMap(expression2);

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