aboutsummaryrefslogtreecommitdiffstats
path: root/rust/bf/src
diff options
context:
space:
mode:
authorelioat <{ID}+{username}@users.noreply.github.com>2024-12-03 12:00:33 -0500
committerelioat <{ID}+{username}@users.noreply.github.com>2024-12-03 12:00:33 -0500
commitc35d5ead81dc92621ff1d7d5104fda8346c74d73 (patch)
tree95dea2a9cec467e879e9e57ddacae720aff0fc99 /rust/bf/src
parent5db4d92b3a6e2db45df6e471d676fd78b07be1f3 (diff)
downloadtour-c35d5ead81dc92621ff1d7d5104fda8346c74d73.tar.gz
*
Diffstat (limited to 'rust/bf/src')
-rw-r--r--rust/bf/src/main.rs6
1 files changed, 3 insertions, 3 deletions
diff --git a/rust/bf/src/main.rs b/rust/bf/src/main.rs
index 9257ae2..e511e69 100644
--- a/rust/bf/src/main.rs
+++ b/rust/bf/src/main.rs
@@ -16,12 +16,12 @@ fn interpret_brainfuck(code: &str) {
'>' => {
pointer += 1;
if pointer >= memory.len() {
- panic!("Pointer out of bounds");
+ panic!("Pointer out of bounds (positive)");
}
}
'<' => {
if pointer == 0 {
- panic!("Pointer out of bounds");
+ panic!("Pointer out of bounds (negative)");
}
pointer -= 1;
}
@@ -36,7 +36,7 @@ fn interpret_brainfuck(code: &str) {
}
',' => {
let mut input = [0u8];
- io::stdin().read_exact(&mut input).expect("Failed to read input");
+ io::stdin().read_exact(&mut input).expect("Failed to read input. Unable to read a single byte from stdin");
memory[pointer] = input[0];
}
'[' => {