Boolean Logic- Choosing true value for outputs
<p>I am currently working with Boolean logic and truth tables. I have been able to create a class that will generate a 2 variable<code>(a,b)</code> table. My main interest is choosing certain inputs in the table and setting a ‘true’ value for its output. I have been able to hard code the above mentioned through <code>override bool GetTruthValue()</code> and display those <code>true</code> value output results in a multiline textbox called <code>OutputTextBox</code>. I want the logic of calculating the truth value to be provided by user. My current approach the logic is being provided by the code. How can I have the user pick which input’s will have an output value of `true? Indicate through checkboxes or separate texboxes(with 1 or 0)? Or other suggestions?</p>

<pre><code>namespace table_outputs
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

    public abstract class TwoItemTruthRow
        {
            protected TwoItemTruthRow(bool a, bool b)
            {
                A = a; B = b;
            }

            public bool A { get; protected set; }
            public bool B { get; protected set; }

            public abstract bool GetTruthValue();
        }

    public class MyCustomTwoItemTruthRow : TwoItemTruthRow
        {
            public MyCustomTwoItemTruthRow(bool a, bool b)
                : base(a, b)
            {
            }

            public override bool GetTruthValue()
            {
                // My custom logic- Hard coded
                return (A &amp;&amp; B) || (A &amp;&amp; !B) || (!A &amp;&amp; !B);
            }
        }

    private static string GetHorizontalLineText()
        {
            return "-----------------------------------------------\r\n";
        }
        private static string GetFormattedTwoItemText(MyCustomTwoItemTruthRow item)
        {
            return string.Format("{0}\t{1}\r\n", item.A, item.B);
        }

    private static IEnumerable&lt;MyCustomTwoItemTruthRow&gt; GenerateTruthTableTwo()
        {
            for (var a = 0; a &lt; 2; a++)
                for (var b = 0; b &lt; 2; b++)
                    yield return new MyCustomTwoItemTruthRow(
                        Convert.ToBoolean(a),
                        Convert.ToBoolean(b));
        }

    private void GenerateTableButton_Click(object sender, EventArgs e)
        {
            InputTextBox.Clear();
            InputTextBox.Text += "A\tB\r\n";
            InputTextBox.Text += GetHorizontalLineText();

            var myTruthTable = GenerateTruthTable().ToList();
            foreach (var item in myTruthTable)
            {
                InputTextBox.Text += GetFormattedTwoItemText(item);
                InputTextBox.Text += GetHorizontalLineText();
            }
        }
        private void ShowTrueValuesButton_Click(object sender, EventArgs e)
        {
            OutputTextBox.Clear();
            OutputTextBox.Text += "True Values\r\n";
            OutputTextBox.Text += "A\tB\r\n";
            OutputTextBox.Text += GetHorizontalLineText();

            var myTruthTable = GenerateTruthTableTwo().ToList();
            foreach (var item in myTruthTable)
            {

                if (item.GetTruthValue())
                    OutputTextBox.Text += GetFormattedTwoItemText(item);
            }
        }


    }
}
</code></pre>

<p><strong>Current WinForm</strong>
<img src="http://i.stack.imgur.com/m4GS5.png" alt="enter image description here"></p>

<p><img src="http://i.stack.imgur.com/dEtCG.png" alt="enter image description here"></p>
