From 142cb9cc0985df8fd537f247c662d7d34df2f962 Mon Sep 17 00:00:00 2001 From: CrispyPin Date: Tue, 12 Dec 2023 22:56:28 +0100 Subject: [PATCH] fix alternate start locations, eat all non-instruction bytes --- src/main.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/main.rs b/src/main.rs index 41b3570..3b121b6 100644 --- a/src/main.rs +++ b/src/main.rs @@ -220,7 +220,10 @@ impl SandWormInterpreter { } } b' ' | 0 => (), - other => panic!("{} not implemented", other as char), + other => { + self.worm_in.push(other); + dont_push_instruction = true; + } } if !dont_push_instruction { self.worm_out.push(instruction); @@ -288,7 +291,7 @@ fn parse(source: &str) -> (Vec>, (usize, usize)) { for (row, line) in source.lines().enumerate() { width = width.max(line.len()); if let Some(col) = line.find('@') { - start_pos = (row, col); + start_pos = (col, row); } program.push(line.as_bytes().to_vec()); }