private void btnCreateRandomProposition_Click(object sender, EventArgs e) { string proposition = PropositionReader.CreateRandomPropositionString(); tbProposition.Text = proposition; createAllConHoldersAndTruthtables(proposition); }
private void timer1_Tick(object sender, EventArgs e) { string hashCode; string proposition; //GENEARTE ALL TABLES AND CONHOLDERS AND TABLEAUX proposition = PropositionReader.CreateRandomPropositionString(); tbProposition.Text = proposition; if (createAllConHoldersAndTruthtables(proposition)) { printVisualTruthtables(table); printTablesInformation(); } CreateTableaux(); //GET HASH CODE OF MAIN TABLE hashCode = table.GetHashCodeHexadecimal(); //COMPARE HASH CODE WITH OTHER TABLES if (hashCode != tableDisjunctive.GetHashCodeHexadecimal()) { testFailed("Disjunctive hashcode does not match", proposition); return; } if (hashCode != tableDisjunctiveSimple.GetHashCodeHexadecimal()) { testFailed("DisjunctiveSimple hashcode does not match", proposition); return; } if (hashCode != tableNand.GetHashCodeHexadecimal()) { testFailed("Nand hashcode does not match", proposition); return; } if (hashCode != tableNandSimple.GetHashCodeHexadecimal()) { testFailed("NandSimple hashcode does not match", proposition); return; } //COMPARE TABLEAUX WITH SIMPLE TRUTHTABLE bool simpleTableResult; if (dgvSimpleTable.Rows.Count > 2) { simpleTableResult = false; } //contains 1 empty row at the bottom, should ignore! else { if (dgvSimpleTable.Rows.Count == 2) { string rowResult = dgvSimpleTable.Rows[0].Cells[dgvSimpleTable.Columns.Count - 1].Value.ToString(); if (rowResult == "1") { simpleTableResult = true; } else if (rowResult == "0") { simpleTableResult = false; } else { throw new Exception("Unknown character"); } } else { throw new Exception("Not possible scenario"); } } if (simpleTableResult != tabHolder.IsTautology) { testFailed("Tautology result from SimpleTable does not match tautology result from Tableaux", proposition); return; } testCounter++; }