void Run() { Tape tape = new Tape(); for (int pc = 0; pc < code.Length; ++pc) { switch (code[pc]) { case '+': tape.Inc(); break; case '-': tape.Dec(); break; case '>': tape.Advance(); break; case '<': tape.Devance(); break; case '[': if (tape.Get() == 0) pc = bracket_map[pc]; break; case ']': if (tape.Get() != 0) pc = bracket_map[pc]; break; case '.': Console.Write((char)tape.Get()); break; } } }
void Run() { Tape tape = new Tape(); for (int pc = 0; pc < code.Length; ++pc) { switch (code[pc]) { case '+': tape.Inc(); break; case '-': tape.Dec(); break; case '>': tape.Advance(); break; case '<': tape.Devance(); break; case '[': if (tape.Get() == 0) { pc = bracket_map[pc]; } break; case ']': if (tape.Get() != 0) { pc = bracket_map[pc]; } break; case '.': Console.Write((char)tape.Get()); break; } } }