private void button_new_Click(object sender, EventArgs e) { if (new_index.Text == "" || new_state.Text == "" || path_to_file.Text == "") { return; } machine = new TuringMachine(path_to_file.Text); RenderMatrix(path_to_file.Text); int index = Convert.ToInt32(new_index.Text); machine.current_index = index; machine.current_state = new_state.Text; machine.current_left = index; Render(index); }
private void button8_Click(object sender, EventArgs e) { if (TurMachine == null) { this.button6.Enabled = true; this.dataGridView1.ClearSelection(); this.dataGridView1.Enabled = false; this.textBox1.Enabled = false; TurMachine = new TuringMachine(); TurMachine.setIlne(this.line); TurMachine.Action = getAction(); colorNextAction(TurMachine.NextQ); return; } MoveHead(dx, dy); try { TurMachine.makeStep(); } catch (Exception er) { MoveHead(-dx, -dy); this.timer1.Stop(); colorError(TurMachine.NextQ); MessageBox.Show(er.Message, "Ошибка!!!"); button6_Click(sender, e); return; } if (TurMachine.NextQ == 0) { MoveHead(-dx, -dy); this.timer1.Stop(); MessageBox.Show("Выполнение программы завершено.", "Информация"); button6_Click(sender, e); return; } MoveHead(-dx, -dy); colorNextAction(TurMachine.NextQ); VoidFilling(); }
private void button6_Click(object sender, EventArgs e) { TurMachine = null; this.timer1.Stop(); this.dataGridView1.Enabled = true; this.паузаToolStripMenuItem.Enabled = false; this.запускToolStripMenuItem1.Enabled = true; this.выполнитьШагToolStripMenuItem.Enabled = true; this.textBox1.Enabled = true; this.button3.Enabled = true; this.button4.Enabled = true; this.button5.Enabled = true; this.button6.Enabled = false; this.button7.Enabled = false; this.button8.Enabled = true; setWhite(); }
private void init() { TurMachine = null; Path = null; copyLine = null; this.timer1.Interval = 1000; this.восстановитьЛентуToolStripMenuItem.Enabled = false; this.оченьБыстроToolStripMenuItem.Checked = false; this.быстроToolStripMenuItem.Checked = false; this.среднеToolStripMenuItem.Checked = true; this.медленноToolStripMenuItem.Checked = false; this.оченьМедленноToolStripMenuItem.Checked = false; this.dataGridView1.Columns.Clear(); this.dataGridView1.Columns.Add(" ", " "); this.dataGridView1.Columns[" "].Width = 50; this.dataGridView1.Columns[" "].ReadOnly = true; this.dataGridView1.Columns[" "].SortMode = DataGridViewColumnSortMode.NotSortable; this.dataGridView1.Columns.Add("Q1", "Q1"); this.dataGridView1.Columns["Q1"].SortMode = DataGridViewColumnSortMode.NotSortable; this.dataGridView1.Rows.Clear(); this.dataGridView1.Rows.Add("_"); controlLen = 0; button3.Enabled = true; button4.Enabled = true; button5.Enabled = true; button6.Enabled = false; button7.Enabled = false; button8.Enabled = true; this.line = new InfinityTape(new Point(478, 53), new Point(482, 73), splitContainer1.Panel1.Controls); VoidFilling(); MoveHead(-dx, -dy); }