diff -r a4e1f63157d8 -r 191cd1de93f1 main_solution5/bf.scala --- a/main_solution5/bf.scala Mon Nov 06 14:18:26 2023 +0000 +++ b/main_solution5/bf.scala Mon Nov 06 21:26:57 2023 +0000 @@ -96,11 +96,8 @@ case '+' => (pc + 1, mp, write(mem, mp, sread(mem, mp) + 1)) case '-' => (pc + 1, mp, write(mem, mp, sread(mem, mp) - 1)) case '.' => { print(sread(mem, mp).toChar); (pc + 1, mp, mem) } - case '[' => - if (sread(mem, mp) == 0) (jumpRight(prog, pc + 1, 0), mp, mem) else (pc + 1, mp, mem) - case ']' => - if (sread(mem, mp) != 0) (jumpLeft(prog, pc - 1, 0), mp, mem) else (pc + 1, mp, mem) - + case '[' => if (sread(mem, mp) == 0) (jumpRight(prog, pc + 1, 0), mp, mem) else (pc + 1, mp, mem) + case ']' => if (sread(mem, mp) != 0) (jumpLeft(prog, pc - 1, 0), mp, mem) else (pc + 1, mp, mem) case _ => (pc + 1, mp, mem) } compute(prog, new_pc, new_mp, new_mem) @@ -220,4 +217,4 @@ //M5a.run(M5a.load_bff("collatz.bf")) //println(M5a.generate("ABC".toList)) -//M5a.run(M5a.generate("Hello World\n".toList)) \ No newline at end of file +//M5a.run(M5a.generate("Hello World\n".toList))