days 16 through 19 i think

This commit is contained in:
Shoofle 2023-12-20 00:16:34 -05:00
parent 9cc7b1a890
commit 02452722bf
804 changed files with 1058 additions and 41 deletions
day16
.idea
src
target
.rustc_info.json
debug
.fingerprint
day16
deps
day16-5b74b45d1b6bc92cday16-5b74b45d1b6bc92c.10obrssb1rrhztbc.rcgu.oday16-5b74b45d1b6bc92c.13jp6iv7k74iqbdd.rcgu.oday16-5b74b45d1b6bc92c.13z2gp4novc0v3ik.rcgu.oday16-5b74b45d1b6bc92c.1aa055j86cjvwnh5.rcgu.oday16-5b74b45d1b6bc92c.1ag5glnyubt1fy9a.rcgu.oday16-5b74b45d1b6bc92c.1b6uiqf0f9e7g14d.rcgu.oday16-5b74b45d1b6bc92c.1e10mike6xrr1nf5.rcgu.oday16-5b74b45d1b6bc92c.1gj11b01mat2xshb.rcgu.oday16-5b74b45d1b6bc92c.1hhfr8rfo8vpabef.rcgu.oday16-5b74b45d1b6bc92c.1jdgob0hp18b23wf.rcgu.oday16-5b74b45d1b6bc92c.1mt3jpifgz54rdhq.rcgu.oday16-5b74b45d1b6bc92c.1nlbfncunky7weqa.rcgu.oday16-5b74b45d1b6bc92c.1qxo2z1ere64zn0j.rcgu.oday16-5b74b45d1b6bc92c.1vbb3p68bi05h89.rcgu.oday16-5b74b45d1b6bc92c.1ycc2h9i6fg7ytt7.rcgu.oday16-5b74b45d1b6bc92c.24kyprh5xa0nhmyf.rcgu.oday16-5b74b45d1b6bc92c.2a90v0rezk0mjtn1.rcgu.oday16-5b74b45d1b6bc92c.2de3bpmsk4c5cis.rcgu.oday16-5b74b45d1b6bc92c.2dlpnfqp6gsvr7om.rcgu.oday16-5b74b45d1b6bc92c.2efer6syzwtckoiz.rcgu.oday16-5b74b45d1b6bc92c.2gx71h4io4vuo5mk.rcgu.oday16-5b74b45d1b6bc92c.2ndzkoa5csnaayr6.rcgu.oday16-5b74b45d1b6bc92c.2oo2sfygsn8bw2wo.rcgu.oday16-5b74b45d1b6bc92c.2rbpvzeqd2htgmv4.rcgu.oday16-5b74b45d1b6bc92c.2tpyz6acieibwyx8.rcgu.oday16-5b74b45d1b6bc92c.2wu50ajuj1sie3sz.rcgu.oday16-5b74b45d1b6bc92c.2xgpe4zh4a1rgayx.rcgu.oday16-5b74b45d1b6bc92c.2ygg4ve9863fnxiw.rcgu.oday16-5b74b45d1b6bc92c.3193pnks5lq4sco4.rcgu.oday16-5b74b45d1b6bc92c.31jx47xd5v2sb8ib.rcgu.oday16-5b74b45d1b6bc92c.31tdadb525knujva.rcgu.oday16-5b74b45d1b6bc92c.33ihin4nc80lqguk.rcgu.oday16-5b74b45d1b6bc92c.374s65o1vi4zpxa3.rcgu.oday16-5b74b45d1b6bc92c.382zd01tqxgdqbl3.rcgu.oday16-5b74b45d1b6bc92c.3cy6v40qox7edvdd.rcgu.oday16-5b74b45d1b6bc92c.3daynomnqeua1tb1.rcgu.oday16-5b74b45d1b6bc92c.3ef0bggtyzctctae.rcgu.oday16-5b74b45d1b6bc92c.3fu6dqjn6xxhcuji.rcgu.oday16-5b74b45d1b6bc92c.3o9hf6qfygdx1b7u.rcgu.oday16-5b74b45d1b6bc92c.3pkggx8ryagrjz3v.rcgu.oday16-5b74b45d1b6bc92c.3qok53cd2shnf4hk.rcgu.oday16-5b74b45d1b6bc92c.3qrd81uccqrmfjkm.rcgu.oday16-5b74b45d1b6bc92c.3stub7cu2kjj0cd9.rcgu.oday16-5b74b45d1b6bc92c.3ykut8vs0b2h1adx.rcgu.oday16-5b74b45d1b6bc92c.43emm65d08nj8m5n.rcgu.oday16-5b74b45d1b6bc92c.44o41c7w0w4hqj2e.rcgu.oday16-5b74b45d1b6bc92c.468self3a5w0omtn.rcgu.oday16-5b74b45d1b6bc92c.4ato8szct01an6a4.rcgu.oday16-5b74b45d1b6bc92c.4cgpz3eano7jrcjs.rcgu.oday16-5b74b45d1b6bc92c.4hyvahy1mkjf35bp.rcgu.oday16-5b74b45d1b6bc92c.4jp6b58cjmtj9gye.rcgu.oday16-5b74b45d1b6bc92c.4jshf1fjo22sdsmq.rcgu.oday16-5b74b45d1b6bc92c.4lw6com1mwmonfzv.rcgu.oday16-5b74b45d1b6bc92c.4lxkmj1kfjgh7ea6.rcgu.oday16-5b74b45d1b6bc92c.4prv9qx1akc6h9av.rcgu.oday16-5b74b45d1b6bc92c.55ffuqaku9ttcc84.rcgu.oday16-5b74b45d1b6bc92c.55jphixhuly5vvas.rcgu.oday16-5b74b45d1b6bc92c.5cx6dzsrff7auqsk.rcgu.oday16-5b74b45d1b6bc92c.5d685uq3c0rdnr8r.rcgu.oday16-5b74b45d1b6bc92c.5dxo0pnbkjzfqe9g.rcgu.oday16-5b74b45d1b6bc92c.5fs7lkguel8k20a4.rcgu.oday16-5b74b45d1b6bc92c.5fw7akpav3ikb3u2.rcgu.oday16-5b74b45d1b6bc92c.c76ka0mk0pq9hes.rcgu.oday16-5b74b45d1b6bc92c.dday16-5b74b45d1b6bc92c.hfin40utzckbq5o.rcgu.oday16-5b74b45d1b6bc92c.lmv1bhroamf1n2f.rcgu.oday16-5b74b45d1b6bc92c.q94jt6nxhqi86by.rcgu.oday16-5b74b45d1b6bc92c.tb4t5kt5gn8vonf.rcgu.oday16-5b74b45d1b6bc92c.u84hkoof8558z9v.rcgu.oday16-5b74b45d1b6bc92c.zu8oux8l9fv1nff.rcgu.oday16-e5a07f0ab55d4573day16-e5a07f0ab55d4573.3lhfi29odd6jk1xi.rcgu.o
incremental/day16-2qgx8a7nb8nyx
s-grkqctwrth-nw9tvy-e08s9spxl5fs
s-grkuhepjn2-6l9z0y-3oh3ipb7r2lmb

8
day16/.idea/.gitignore vendored Normal file
View File

@ -0,0 +1,8 @@
# Default ignored files
/shelf/
/workspace.xml
# Editor-based HTTP Client requests
/httpRequests/
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml

11
day16/.idea/day16.iml Normal file
View File

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="EMPTY_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
<excludeFolder url="file://$MODULE_DIR$/target" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

8
day16/.idea/modules.xml Normal file
View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/day16.iml" filepath="$PROJECT_DIR$/.idea/day16.iml" />
</modules>
</component>
</project>

6
day16/.idea/vcs.xml Normal file
View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$/.." vcs="Git" />
</component>
</project>

View File

@ -34,21 +34,7 @@ fn main() {
}
//print_map(&g);
let visited = &mut HashSet::<Record>::new();
trace(&g, visited, 0,0, 1,0);
let mut sum = 0;
for (x, y, _, _) in visited.iter() {
if v[*y as usize][*x as usize] == '#' {
continue;
}
v[*y as usize][*x as usize] = '#';
sum += 1
}
//print_map(&v);
let sum = count(&g, (0,0,1,0));
println!("totally marked off {sum} locations when entering from the upper left going right");
let mut maximum = 0;
@ -60,19 +46,16 @@ fn main() {
}
for y in 0..g.len() {
let from_the_left = count(&g,
(0, y as i32,
1, 0));
let from_the_left = count(&g, (0, y as i32, 1, 0));
if from_the_left > maximum { maximum = from_the_left; }
let from_the_right = count(&g,
(g[0].len() as i32, y as i32,
-1, 0));
let from_the_right = count(&g, (g[0].len() as i32, y as i32, -1, 0));
if from_the_right > maximum { maximum = from_the_right; }
}
println!("the highest number of locations we could visit was {maximum}");
}
#[allow(dead_code)]
fn print_map(mat: &Vec<Vec<char>>) {
for row in mat {
for c in row {
@ -84,33 +67,30 @@ fn print_map(mat: &Vec<Vec<char>>) {
fn trace(mat: &Vec<Vec<char>>,
visited: &mut HashSet<Record>,
start_x: i32,
start_y: i32,
start_dx: i32,
start_dy: i32) -> () {
start: Record) -> () {
let mut cx = start_x;
let mut cy = start_y;
let mut dx = start_dx;
let mut dy = start_dy;
let mut cx = start.0;
let mut cy = start.1;
let mut dx = start.2;
let mut dy = start.3;
while cy >= 0 && (cy as usize) < mat.len() && cx >= 0 && (cx as usize) < mat[0].len() {
if visited.contains(&(cx, cy, dx, dy)) { return (); }
visited.insert((cx, cy, dx, dy));
if visited.contains(&start) { return (); }
visited.insert(start);
match mat[cy as usize][cx as usize] {
'\\' => (dx, dy) = (dy, dx),
'/' => (dx, dy) = (-dy, -dx),
'|' =>
if dx != 0 {
trace(mat, visited, cx, cy, 0, 1);
trace(mat, visited, cx, cy, 0, -1);
trace(mat, visited, (cx, cy, 0, 1));
trace(mat, visited, (cx, cy, 0, -1));
return;
},
'-' =>
if dy != 0 {
trace(mat, visited, cx, cy, 1, 0);
trace(mat, visited, cx, cy, -1, 0);
trace(mat, visited, (cx, cy, 1, 0));
trace(mat, visited, (cx, cy, -1, 0));
return;
},
_ => ()
@ -123,7 +103,7 @@ fn trace(mat: &Vec<Vec<char>>,
fn count(mat: &Vec<Vec<char>>, start: Record) -> i32 {
let mut visit_set = HashSet::<Record>::new();
trace(mat, &mut visit_set, start.0, start.1, start.2, start.3);
trace(mat, &mut visit_set, start);
let mut v = Vec::<Vec<char>>::new();
for row in mat {

View File

@ -1 +1 @@
{"rustc_fingerprint":11672801278650259402,"outputs":{"15729799797837862367":{"success":true,"status":"","code":0,"stdout":"___\nlib___.rlib\nlib___.dylib\nlib___.dylib\nlib___.a\nlib___.dylib\n/Users/shoofle/.rustup/toolchains/stable-x86_64-apple-darwin\noff\npacked\nunpacked\n___\ndebug_assertions\npanic=\"unwind\"\nproc_macro\ntarget_arch=\"x86_64\"\ntarget_endian=\"little\"\ntarget_env=\"\"\ntarget_family=\"unix\"\ntarget_feature=\"cmpxchg16b\"\ntarget_feature=\"fxsr\"\ntarget_feature=\"sse\"\ntarget_feature=\"sse2\"\ntarget_feature=\"sse3\"\ntarget_feature=\"ssse3\"\ntarget_has_atomic=\"128\"\ntarget_has_atomic=\"16\"\ntarget_has_atomic=\"32\"\ntarget_has_atomic=\"64\"\ntarget_has_atomic=\"8\"\ntarget_has_atomic=\"ptr\"\ntarget_os=\"macos\"\ntarget_pointer_width=\"64\"\ntarget_vendor=\"apple\"\nunix\n","stderr":""},"4614504638168534921":{"success":true,"status":"","code":0,"stdout":"rustc 1.69.0 (84c898d65 2023-04-16)\nbinary: rustc\ncommit-hash: 84c898d65adf2f39a5a98507f1fe0ce10a2b8dbc\ncommit-date: 2023-04-16\nhost: x86_64-apple-darwin\nrelease: 1.69.0\nLLVM version: 15.0.7\n","stderr":""}},"successes":{}}
{"rustc_fingerprint":14318102787793507742,"outputs":{"15729799797837862367":{"success":true,"status":"","code":0,"stdout":"___\nlib___.rlib\nlib___.dylib\nlib___.dylib\nlib___.a\nlib___.dylib\n/Users/shoofle/.rustup/toolchains/stable-x86_64-apple-darwin\noff\npacked\nunpacked\n___\ndebug_assertions\npanic=\"unwind\"\nproc_macro\ntarget_arch=\"x86_64\"\ntarget_endian=\"little\"\ntarget_env=\"\"\ntarget_family=\"unix\"\ntarget_feature=\"cmpxchg16b\"\ntarget_feature=\"fxsr\"\ntarget_feature=\"sse\"\ntarget_feature=\"sse2\"\ntarget_feature=\"sse3\"\ntarget_feature=\"sse4.1\"\ntarget_feature=\"ssse3\"\ntarget_has_atomic=\"128\"\ntarget_has_atomic=\"16\"\ntarget_has_atomic=\"32\"\ntarget_has_atomic=\"64\"\ntarget_has_atomic=\"8\"\ntarget_has_atomic=\"ptr\"\ntarget_os=\"macos\"\ntarget_pointer_width=\"64\"\ntarget_vendor=\"apple\"\nunix\n","stderr":""},"4614504638168534921":{"success":true,"status":"","code":0,"stdout":"rustc 1.74.1 (a28077b28 2023-12-04)\nbinary: rustc\ncommit-hash: a28077b28a02b92985b3a3faecf92813155f1ea1\ncommit-date: 2023-12-04\nhost: x86_64-apple-darwin\nrelease: 1.74.1\nLLVM version: 17.0.4\n","stderr":""}},"successes":{}}

View File

@ -0,0 +1 @@
This file has an mtime of when this was started.

View File

@ -0,0 +1 @@
71b09de1aded0212

View File

@ -0,0 +1 @@
{"rustc":4443399816165520464,"features":"[]","target":250502024769020866,"profile":13053956386274884697,"path":1684066648322511884,"deps":[],"local":[{"CheckDepInfo":{"dep_info":"debug/.fingerprint/day16-03900f28025d4c7f/dep-test-bin-day16"}}],"rustflags":[],"metadata":7797948686568424061,"config":2202906307356721367,"compile_kind":0}

View File

@ -0,0 +1 @@
2137fc3fa44ab9f3

View File

@ -0,0 +1 @@
{"rustc":4443399816165520464,"features":"[]","target":250502024769020866,"profile":237655285757591511,"path":1684066648322511884,"deps":[],"local":[{"CheckDepInfo":{"dep_info":"debug/.fingerprint/day16-5b74b45d1b6bc92c/dep-bin-day16"}}],"rustflags":[],"metadata":7797948686568424061,"config":2202906307356721367,"compile_kind":0}

View File

@ -0,0 +1 @@
This file has an mtime of when this was started.

View File

@ -0,0 +1 @@
297e92fdabd39aaf

View File

@ -0,0 +1 @@
{"rustc":3659767333214291318,"features":"[]","target":250502024769020866,"profile":17483045194147818835,"path":1684066648322511884,"deps":[],"local":[{"CheckDepInfo":{"dep_info":"debug/.fingerprint/day16-7763588c3a64e881/dep-bin-day16"}}],"rustflags":[],"metadata":7797948686568424061,"config":2202906307356721367,"compile_kind":0}

View File

@ -0,0 +1 @@
This file has an mtime of when this was started.

View File

@ -0,0 +1 @@
e9e854068db64f0a

View File

@ -0,0 +1 @@
{"rustc":4443399816165520464,"features":"[]","target":250502024769020866,"profile":13396965805329499462,"path":1684066648322511884,"deps":[],"local":[{"CheckDepInfo":{"dep_info":"debug/.fingerprint/day16-886360bced410ea3/dep-bin-day16"}}],"rustflags":[],"metadata":7797948686568424061,"config":2202906307356721367,"compile_kind":0}

View File

@ -0,0 +1 @@
This file has an mtime of when this was started.

View File

@ -1,2 +0,0 @@
{"message":"function `print_map` is never used","code":{"code":"dead_code","explanation":null},"level":"warning","spans":[{"file_name":"src/main.rs","byte_start":2010,"byte_end":2019,"line_start":76,"line_end":76,"column_start":4,"column_end":13,"is_primary":true,"text":[{"text":"fn print_map(mat: &Vec<Vec<char>>) {","highlight_start":4,"highlight_end":13}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"`#[warn(dead_code)]` on by default","code":null,"level":"note","spans":[],"children":[],"rendered":null}],"rendered":"\u001b[0m\u001b[1m\u001b[33mwarning\u001b[0m\u001b[0m\u001b[1m: function `print_map` is never used\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m--> \u001b[0m\u001b[0msrc/main.rs:76:4\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m|\u001b[0m\n\u001b[0m\u001b[1m\u001b[38;5;12m76\u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m|\u001b[0m\u001b[0m \u001b[0m\u001b[0mfn print_map(mat: &Vec<Vec<char>>) {\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m| \u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[33m^^^^^^^^^\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m|\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m= \u001b[0m\u001b[0m\u001b[1mnote\u001b[0m\u001b[0m: `#[warn(dead_code)]` on by default\u001b[0m\n\n"}
{"message":"1 warning emitted","code":null,"level":"warning","spans":[],"children":[],"rendered":"\u001b[0m\u001b[1m\u001b[33mwarning\u001b[0m\u001b[0m\u001b[1m: 1 warning emitted\u001b[0m\n\n"}

View File

@ -1,2 +0,0 @@
{"message":"function `print_map` is never used","code":{"code":"dead_code","explanation":null},"level":"warning","spans":[{"file_name":"src/main.rs","byte_start":2010,"byte_end":2019,"line_start":76,"line_end":76,"column_start":4,"column_end":13,"is_primary":true,"text":[{"text":"fn print_map(mat: &Vec<Vec<char>>) {","highlight_start":4,"highlight_end":13}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"`#[warn(dead_code)]` on by default","code":null,"level":"note","spans":[],"children":[],"rendered":null}],"rendered":"\u001b[0m\u001b[1m\u001b[33mwarning\u001b[0m\u001b[0m\u001b[1m: function `print_map` is never used\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m--> \u001b[0m\u001b[0msrc/main.rs:76:4\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m|\u001b[0m\n\u001b[0m\u001b[1m\u001b[38;5;12m76\u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m|\u001b[0m\u001b[0m \u001b[0m\u001b[0mfn print_map(mat: &Vec<Vec<char>>) {\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m| \u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[33m^^^^^^^^^\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m|\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m= \u001b[0m\u001b[0m\u001b[1mnote\u001b[0m\u001b[0m: `#[warn(dead_code)]` on by default\u001b[0m\n\n"}
{"message":"1 warning emitted","code":null,"level":"warning","spans":[],"children":[],"rendered":"\u001b[0m\u001b[1m\u001b[33mwarning\u001b[0m\u001b[0m\u001b[1m: 1 warning emitted\u001b[0m\n\n"}

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,5 @@
/Users/shoofle/Projects/aoc_2023/day16/target/debug/deps/day16-5b74b45d1b6bc92c: src/main.rs
/Users/shoofle/Projects/aoc_2023/day16/target/debug/deps/day16-5b74b45d1b6bc92c.d: src/main.rs
src/main.rs:

Some files were not shown because too many files have changed in this diff Show More