示例#1
0
 static void NullTapes()
 {
     foreach (WExpr program in programs)
     {
         Console.WriteLine(program.ToString());
         Console.ReadKey();
         var     M = program.ToTMCB(-1);
         bool    dummy;
         int[][] output = M.Run(program.GetNumVariables(), out dummy);
         Console.WriteLine("output:");
         Console.WriteLine(WhileUtilities.TapesToString(output, M.blank));
         Console.ReadKey();
     }
 }
示例#2
0
 static void ConversionAndTMFunctionality(params int[] indices)
 {
     if (indices.Length == 0)
     {
         foreach (WExpr program in programs)
         {
             Console.WriteLine(program.ToString());
             Console.ReadKey();
             var M = program.ToTMCB(-1);
             foreach (int[][] input in WhileUtilities.NonNegIntTestInputs(program.GetNumVariables(), 4, program.GetUselessVariables().ToArray()))
             {
                 Console.WriteLine("input:");
                 Console.WriteLine(WhileUtilities.TapesToString(input, M.blank));
                 bool    dummy;
                 int[][] output = M.Run(input, out dummy);
                 Console.WriteLine("output:");
                 Console.WriteLine(WhileUtilities.TapesToString(output, M.blank));
                 Console.ReadKey();
             }
         }
     }
     else
     {
         foreach (int index in indices)
         {
             Console.WriteLine(programs[index].ToString());
             Console.ReadKey();
             var M = programs[index].ToTMCB(-1);
             foreach (int[][] input in WhileUtilities.NonNegIntTestInputs(programs[index].GetNumVariables(), 4, programs[index].GetUselessVariables().ToArray()))
             {
                 Console.WriteLine("input:");
                 Console.WriteLine(WhileUtilities.TapesToString(input, M.blank));
                 bool    dummy;
                 int[][] output = M.Run(input, out dummy);
                 Console.WriteLine("output:");
                 Console.WriteLine(WhileUtilities.TapesToString(output, M.blank));
                 Console.ReadKey();
             }
         }
     }
 }