Exemplo n.º 1
0
 /// <param name="p">The current state.</param>
 /// <param name="x">The current tape cell contents.</param>
 /// <param name="q">The next state.</param>
 /// <param name="y">The character to replace the tape cell with.</param>
 /// <param name="d">The direction to move the tape head after transitioning.</param>
 public TuringTransition(State p, char x, State q, char y, TuringMachine.Direction d) : base(p, x, q)
 {
     B         = y;
     Direction = d;
     if (p == null || q == null)
     {
         throw new NullReferenceException("Null state reference not allowed!");
     }
 }
Exemplo n.º 2
0
        private static TuringMachine.ParseError ParseDirection(string parseString, out TuringMachine.Direction direction)
        {
            switch (parseString)
            {
            case "L":
                direction = TuringMachine.Direction.L;
                return(null);

            case "R":
                direction = TuringMachine.Direction.R;
                return(null);

            default:
                direction = TuringMachine.Direction.L;
                return(new TuringMachine.ParseError("Invalid direction symbol: \"" + parseString + "\""));
            }
        }