Exemplo n.º 1
0
    def minimize_clicked(self):
        if self.validate_input():
            self.bigEditor.clear()

            mts = self.mterm_edit.text().split(' ')

            #remove any duplicates from the list
            #remove any non integers from the list
            mts = list(set(filter(lambda x: self.representsInt(x), mts)))

            dcs = self.dcare_edit.text().split(' ')

            #remove any non integers from the list
            dcs = list(set(filter(lambda x: self.representsInt(x), dcs)))

            vs = self.v_edit.text().split(' ')
            vs = list(filter(lambda x: x, vs))

            qm = QM(mts, dcs, vs)
            pis = qm.pis()
            qm.primary_epis()
            self.bigEditor.append('Prime Implicants')

            print(qm.procedure)
            for pi in pis:
                self.bigEditor.append(qm.procedure)
                self.bigEditor.append('\n')
Exemplo n.º 2
0
    def test_pis(self):
        #test the combine generation with an empty generation
        minterms = [1, 2, 3, 4, 5, 6, 15]
        qm = QM(minterms)
        #expected pass test case

        self.assertEqual(
            qm.pis(), ['1111', '00_1', '0_01', '001_', '0_10', '010_', '01_0'])