update bf interpreter

This commit is contained in:
Sebastian Hugentobler 2025-05-28 12:02:49 +02:00
parent 94b57f8304
commit e0ab0a6c67
Signed by: shu
SSH key fingerprint: SHA256:ppcx6MlixdNZd5EUM1nkHOKoyQYoJwzuQKXM6J/t66M

View file

@ -71,7 +71,7 @@ class Interpreter {
} }
if (instruction == "[" and tape.current.data < 0.0001) { if (instruction == "[" and tape.current.data == 0) {
instruction = read(this.bfpath); instruction = read(this.bfpath);
var bracketCount = 1; var bracketCount = 1;
while (bracketCount > 0 and instruction != nil) { while (bracketCount > 0 and instruction != nil) {
@ -81,7 +81,7 @@ class Interpreter {
} }
} }
if (instruction == "]" and tape.current.data >= 0.0001) { if (instruction == "]" and tape.current.data != 0) {
instruction = read(this.bfpath, true); instruction = read(this.bfpath, true);
var bracketCount = 1; var bracketCount = 1;
while (bracketCount > 0 and instruction != nil) { while (bracketCount > 0 and instruction != nil) {