diff options
author | Justin Wernick <justin@worthe-it.co.za> | 2022-04-19 20:22:56 +0200 |
---|---|---|
committer | Justin Wernick <justin@worthe-it.co.za> | 2022-04-19 20:23:15 +0200 |
commit | 174772b5b8d9f5bf5e3c8e8152adfd89f0e83f6b (patch) | |
tree | a003b748ee939b30a2bcd3caf2378228baa304c1 /aoc18/src/main.rs | |
parent | fd75b3fb95ad049b0025cb8fc0b3459b8f872d61 (diff) |
Refile for merging repos
Diffstat (limited to 'aoc18/src/main.rs')
-rw-r--r-- | aoc18/src/main.rs | 20 |
1 files changed, 0 insertions, 20 deletions
diff --git a/aoc18/src/main.rs b/aoc18/src/main.rs deleted file mode 100644 index 52ad7a9..0000000 --- a/aoc18/src/main.rs +++ /dev/null @@ -1,20 +0,0 @@ -fn main() { - let init: Vec<char> = ".^^..^...^..^^.^^^.^^^.^^^^^^.^.^^^^.^^.^^^^^^.^...^......^...^^^..^^^.....^^^^^^^^^....^^...^^^^..^".chars().collect(); - - let mut map = Vec::new(); - map.push(init); - - for _ in 1..400000 { - let last = map.last().unwrap().clone(); - let mut next = Vec::new(); - for i in 0..last.len() { - let left = if i == 0 { '.' } else { last[i-1] }; - let right = if i == last.len()-1 { '.' } else { last[i+1] }; - next.push(if left == right { '.' } else { '^' }); - } - map.push(next); - } - - let safe_count = map.iter().map(|row| row.iter().filter(|&&c| c=='.').count() as u32).sum::<u32>(); - println!("Safe tiles: {}", safe_count); -} |