public void makeStep() { if (nextQ == 0) { return; } string symbol = ilne[ilne.PosHead].Text; ActionT act = action[symbol][nextQ - 1]; if (act == null) { throw new Exception("Нет команды в ячейке (" + ((symbol == "")?"_": symbol) + ",Q" + nextQ + ")"); } nextQ = act.Status; if (act.Symbol == "_") { ilne[ilne.PosHead].Text = ""; } else { ilne[ilne.PosHead].Text = act.Symbol; } switch (act.Act) { case Move.Right: ilne.MoveRight(); break; case Move.Left: ilne.MoveLeft(); break; } }
private TuringAction getAction() { TuringAction tuAct = new TuringAction(line.Alphabet); ActionT[][] act = new ActionT[this.dataGridView1.Rows.Count][]; for (int i = 0; i < this.dataGridView1.Rows.Count; i++) { act[i] = new ActionT[this.dataGridView1.Columns.Count - 1]; } for (int i = 0; i < this.dataGridView1.Rows.Count; ++i) { for (int j = 1; j < this.dataGridView1.Columns.Count; ++j) { act[i][j - 1] = (ActionT)this.dataGridView1.Rows[i].Cells[j].Value; } } tuAct.setAction(act); return(tuAct); }