Exemple #1
0
 public IEnumerable <Position> Execute(BrainfuckEnv be)
 {
     foreach (var node in _nodes)
     {
         foreach (var pos in node.Execute(be))
         {
             yield return(pos);
         }
     }
     yield return(_posEnd);
 }
Exemple #2
0
        public override IEnumerable <Position> Execute(BrainfuckEnv be)
        {
            yield return(_posStart);

            while (be.IsNonZero)
            {
                foreach (var inner in _inner)
                {
                    foreach (var pos in inner.Execute(be))
                    {
                        yield return(pos);
                    }
                }
                yield return(_posEnd);
            }
        }
Exemple #3
0
        public override IEnumerable <Position> Execute(BrainfuckEnv be)
        {
            yield return(_pos);

            switch (_char)
            {
            case '+': be.Inc(); break;

            case '-': be.Dec(); break;

            case '<': be.MoveLeft(); break;

            case '>': be.MoveRight(); break;

            case '.': be.BfOutput(); break;

            case ',': be.BfInput(); break;

            default:
                break;
            }
        }
Exemple #4
0
 public abstract IEnumerable <Position> Execute(BrainfuckEnv be);