Single byte input instead of buffering the input

master
Wynd 2024-10-22 21:54:09 +03:00
parent f39dde9c64
commit 5d7231ae8c
1 changed files with 1 additions and 5 deletions

View File

@ -9,7 +9,6 @@ pub fn run(program: Vec<u8>) {
let mut ip: usize = 0; let mut ip: usize = 0;
let mut icount: usize = 0; let mut icount: usize = 0;
let mut user_input: Vec<u8> = vec![];
let mut table: HashMap<usize, usize> = HashMap::new(); let mut table: HashMap<usize, usize> = HashMap::new();
let mut stack: VecDeque<usize> = VecDeque::new(); let mut stack: VecDeque<usize> = VecDeque::new();
@ -55,10 +54,7 @@ pub fn run(program: Vec<u8>) {
icount += 1; icount += 1;
} }
b',' => { b',' => {
if user_input.is_empty() { tape[cell_index] = input().remove(0);
user_input = input();
}
tape[cell_index] = user_input.remove(0);
icount += 1; icount += 1;
} }
b'[' => { b'[' => {