Exemplo n.º 1
0
        public void closeLoop()
        {
            int counted = 0;

            while (true)
            {
                getPrevious();
                if (getCurrent() == 'l' || getCurrent() == 'r')
                {
                    m.getLogic().execute(getCurrent());
                    m.getLogic().execute(getCurrent());
                    m.getLogic().execute(getCurrent());
                }
                if (getCurrent() == '?')
                {
                    if (hasFollowing(getOpposite(dir)) && directionNotEmpty(getOpposite(dir)))
                    {
                        continue;
                    }
                    else
                    {
                        turnLeft();
                    }
                }
                if (commandArray[indexX, indexY] == ']')
                {
                    counted++;
                }
                if (commandArray[indexX, indexY] == '[')
                {
                    if (counted == 0)
                    {
                        break;
                    }
                    else
                    {
                        counted--;
                    }
                }
            }
        }
Exemplo n.º 2
0
 private void output_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.KeyCode == Keys.Enter)
     {
         output.ReadOnly       = true;
         output.SelectionStart = output.TextLength;
         output.SelectionColor = Color.White;
         m.getLogic().setInput(output.Lines[output.Lines.Length - 1]);
         toOutput("\r\n");
         m.setPause(false);
         m.run();
     }
 }