Skip to content
This repository was archived by the owner on Nov 25, 2019. It is now read-only.

Commit 0ffeb36

Browse files
committed
Fixeroni
1 parent 4793c9d commit 0ffeb36

File tree

1 file changed

+9
-11
lines changed

1 file changed

+9
-11
lines changed

rust/main.rs

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -83,18 +83,16 @@ fn evaluate(instructions: Vec<char>) {
8383
}
8484
},
8585
']' => {
86-
if tape[mem_ptr] == 0x00 {
87-
let mut balance = 1;
88-
// find the corresponding opening bracket, move the ip just before it
89-
loop {
90-
if instructions[ins_ptr] == '[' {
91-
balance += 1
92-
} else if instructions[ins_ptr] == ']' {
93-
balance -= 1
94-
}
95-
ins_ptr -= 1;
96-
if balance == 0 { break }
86+
let mut balance = 0;
87+
// find the corresponding opening bracket, move the ip just before it
88+
loop {
89+
if instructions[ins_ptr] == '[' {
90+
balance += 1
91+
} else if instructions[ins_ptr] == ']' {
92+
balance -= 1
9793
}
94+
ins_ptr -= 1;
95+
if balance == 0 { break }
9896
}
9997
}
10098
_ => unreachable!(),

0 commit comments

Comments
 (0)