Ejemplo n.º 1
0
        public void setCurrentTuringAlg(TuringAlg alg)
        {
            isEnd = false;
            log.Clear();

            turingAlg            = alg;
            this.programm        = alg.getFormalProgramm();
            turingAlg.MoveEvent += this.onTuringMove;
            turingAlg.startCalculation();
        }
Ejemplo n.º 2
0
 private void generateFormalProgram()
 {
     formalProgram             = new FormalTuringProgramm();
     formalProgram.alphabit    = alphabit;
     formalProgram.comandCount = comands.Length;
     formalProgram.comandTable = new string[comands.Length, alphabit.Length];
     formalProgram.comandsName = comands;
     for (int i = 0; i < comands.Length; i++)
     {
         for (int j = 0; j < alphabit.Length; j++)
         {
             ComandDescription programInstruction = programm[i, j];
             string            item;
             if (programInstruction == null)
             {
                 item = "none";
             }
             else
             {
                 item = comands[i] + " '" + alphabit[j] + "'->";
                 if (i > 0)
                 {
                     item += comands[programInstruction.newState] + " '" + alphabit[programInstruction.newSymbol] + "' ";
                     if (programInstruction.move != moveType.none)
                     {
                         item += programInstruction.move == moveType.right ? "R" : "L";
                     }
                 }
                 else
                 {
                     item += "exit";
                 }
             }
             formalProgram.comandTable[i, j] = item;
         }
     }
 }