Example #1
0
        private void SubmitButton_Click(object sender, EventArgs e)
        {
            resultTextBox.Clear();
            resultTextBox.BackColor = Color.LightGray;
            //validating that the input is 0 and 1 only
            bool validText = true;

            for (int i = 0; i < inputTextBox.Text.Length; i++)
            {
                if (inputTextBox.Text[i] != '0' && inputTextBox.Text[i] != '1')
                {
                    MessageBox.Show("Input word may contain 0 and 1 only !!!");
                    validText         = false;
                    inputTextBox.Text = "";
                    break;
                }
            }

            if (validText)
            {
                TM.tape = new Tape();
                TM.tape.setTapeState(inputTextBox.Text);
                refreshTape();
                allStates         = TM.runTuringMachine(inputTextBox.Text);
                currentStateIndex = 0;
                curStateId        = prevStateId = allStates[0].id;
                GraphicalTMPanel.Refresh();
            }
        }
        private void SubmitButton_Click(object sender, EventArgs e)
        {
            resultTextBox.Clear();
            resultTextBox.BackColor = Color.LightGray;


            TM.tape = new Tape();
            TM.tape.setTapeState(inputTextBox.Text);
            refreshTape();

            allStates = TM.runTuringMachine(inputTextBox.Text);

            TTransition.Text = TM.trans[0];

            currentStateIndex = 0;
            curStateId        = prevStateId = allStates[0].id;
        }