day 1, part 2 in progress

This commit is contained in:
Tabby 2025-12-01 23:09:26 +00:00
commit dd9c8b44c4
570 changed files with 10376 additions and 0 deletions

7
aoc-0/Cargo.lock generated Normal file
View file

@ -0,0 +1,7 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 4
[[package]]
name = "aoc-0"
version = "0.1.0"

6
aoc-0/Cargo.toml Normal file
View file

@ -0,0 +1,6 @@
[package]
name = "aoc-0"
version = "0.1.0"
edition = "2024"
[dependencies]

3
aoc-0/src/main.rs Normal file
View file

@ -0,0 +1,3 @@
fn main() {
println!("Hello, world!");
}

View file

@ -0,0 +1 @@
{"rustc_fingerprint":640939955106008076,"outputs":{"11857020428658561806":{"success":true,"status":"","code":0,"stdout":"___\nlib___.rlib\nlib___.so\nlib___.so\nlib___.a\nlib___.so\n/home/tabby/.rustup/toolchains/stable-x86_64-unknown-linux-gnu\noff\npacked\nunpacked\n___\ndebug_assertions\nfmt_debug=\"full\"\noverflow_checks\npanic=\"unwind\"\nproc_macro\nrelocation_model=\"pic\"\ntarget_abi=\"\"\ntarget_arch=\"x86_64\"\ntarget_endian=\"little\"\ntarget_env=\"gnu\"\ntarget_family=\"unix\"\ntarget_feature=\"fxsr\"\ntarget_feature=\"sse\"\ntarget_feature=\"sse2\"\ntarget_feature=\"x87\"\ntarget_has_atomic\ntarget_has_atomic=\"16\"\ntarget_has_atomic=\"32\"\ntarget_has_atomic=\"64\"\ntarget_has_atomic=\"8\"\ntarget_has_atomic=\"ptr\"\ntarget_has_atomic_equal_alignment=\"16\"\ntarget_has_atomic_equal_alignment=\"32\"\ntarget_has_atomic_equal_alignment=\"64\"\ntarget_has_atomic_equal_alignment=\"8\"\ntarget_has_atomic_equal_alignment=\"ptr\"\ntarget_has_atomic_load_store\ntarget_has_atomic_load_store=\"16\"\ntarget_has_atomic_load_store=\"32\"\ntarget_has_atomic_load_store=\"64\"\ntarget_has_atomic_load_store=\"8\"\ntarget_has_atomic_load_store=\"ptr\"\ntarget_has_reliable_f128\ntarget_has_reliable_f16\ntarget_has_reliable_f16_math\ntarget_os=\"linux\"\ntarget_pointer_width=\"64\"\ntarget_thread_local\ntarget_vendor=\"unknown\"\nub_checks\nunix\n","stderr":""},"7971740275564407648":{"success":true,"status":"","code":0,"stdout":"___\nlib___.rlib\nlib___.so\nlib___.so\nlib___.a\nlib___.so\n/home/tabby/.rustup/toolchains/stable-x86_64-unknown-linux-gnu\noff\npacked\nunpacked\n___\ndebug_assertions\npanic=\"unwind\"\nproc_macro\ntarget_abi=\"\"\ntarget_arch=\"x86_64\"\ntarget_endian=\"little\"\ntarget_env=\"gnu\"\ntarget_family=\"unix\"\ntarget_feature=\"fxsr\"\ntarget_feature=\"sse\"\ntarget_feature=\"sse2\"\ntarget_has_atomic=\"16\"\ntarget_has_atomic=\"32\"\ntarget_has_atomic=\"64\"\ntarget_has_atomic=\"8\"\ntarget_has_atomic=\"ptr\"\ntarget_os=\"linux\"\ntarget_pointer_width=\"64\"\ntarget_vendor=\"unknown\"\nunix\n","stderr":""},"17747080675513052775":{"success":true,"status":"","code":0,"stdout":"rustc 1.91.1 (ed61e7d7e 2025-11-07)\nbinary: rustc\ncommit-hash: ed61e7d7e242494fb7057f2657300d9e77bb4fcb\ncommit-date: 2025-11-07\nhost: x86_64-unknown-linux-gnu\nrelease: 1.91.1\nLLVM version: 21.1.2\n","stderr":""}},"successes":{}}

View file

@ -0,0 +1,3 @@
Signature: 8a477f597d28d172789f06886806bc55
# This file is a cache directory tag created by cargo.
# For information about cache directory tags see https://bford.info/cachedir/

View file

View file

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

View file

@ -0,0 +1 @@
e09ff61f112aaddf

View file

@ -0,0 +1 @@
{"rustc":4826714390000139368,"features":"[]","declared_features":"[]","target":1188446607402963624,"profile":3316208278650011218,"path":4942398508502643691,"deps":[],"local":[{"CheckDepInfo":{"dep_info":"debug/.fingerprint/aoc-0-1af2a37aa8c4259b/dep-test-bin-aoc-0","checksum":false}}],"rustflags":[],"config":2069994364910194474,"compile_kind":0}

View file

@ -0,0 +1 @@
d6cb1e039607d404

View file

@ -0,0 +1 @@
{"rustc":4826714390000139368,"features":"[]","declared_features":"[]","target":1188446607402963624,"profile":17672942494452627365,"path":4942398508502643691,"deps":[],"local":[{"CheckDepInfo":{"dep_info":"debug/.fingerprint/aoc-0-69efc4ff0b356e2c/dep-bin-aoc-0","checksum":false}}],"rustflags":[],"config":2069994364910194474,"compile_kind":0}

View file

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

View file

@ -0,0 +1 @@
95ec37987ce156dd

View file

@ -0,0 +1 @@
{"rustc":4826714390000139368,"features":"[]","declared_features":"[]","target":1188446607402963624,"profile":8731458305071235362,"path":4942398508502643691,"deps":[],"local":[{"CheckDepInfo":{"dep_info":"debug/.fingerprint/aoc-0-765fa9d832b53ea9/dep-bin-aoc-0","checksum":false}}],"rustflags":[],"config":2069994364910194474,"compile_kind":0}

View file

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

BIN
aoc-0/target/debug/aoc-0 Executable file

Binary file not shown.

View file

@ -0,0 +1 @@
/home/tabby/rust-projects/aoc-0/target/debug/aoc-0: /home/tabby/rust-projects/aoc-0/src/main.rs

View file

@ -0,0 +1,5 @@
/home/tabby/rust-projects/aoc-0/target/debug/deps/aoc_0-1af2a37aa8c4259b.d: src/main.rs
/home/tabby/rust-projects/aoc-0/target/debug/deps/libaoc_0-1af2a37aa8c4259b.rmeta: src/main.rs
src/main.rs:

View file

@ -0,0 +1,5 @@
/home/tabby/rust-projects/aoc-0/target/debug/deps/aoc_0-69efc4ff0b356e2c.d: src/main.rs
/home/tabby/rust-projects/aoc-0/target/debug/deps/libaoc_0-69efc4ff0b356e2c.rmeta: src/main.rs
src/main.rs:

Binary file not shown.

View file

@ -0,0 +1,5 @@
/home/tabby/rust-projects/aoc-0/target/debug/deps/aoc_0-765fa9d832b53ea9.d: src/main.rs
/home/tabby/rust-projects/aoc-0/target/debug/deps/aoc_0-765fa9d832b53ea9: src/main.rs
src/main.rs:

View file

@ -0,0 +1,2 @@
Blocking waiting for file lock on package cache
Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.02s

View file

@ -0,0 +1,3 @@
{"reason":"compiler-artifact","package_id":"path+file:///home/tabby/rust-projects/aoc-0#0.1.0","manifest_path":"/home/tabby/rust-projects/aoc-0/Cargo.toml","target":{"kind":["bin"],"crate_types":["bin"],"name":"aoc-0","src_path":"/home/tabby/rust-projects/aoc-0/src/main.rs","edition":"2024","doc":true,"doctest":false,"test":true},"profile":{"opt_level":"0","debuginfo":2,"debug_assertions":true,"overflow_checks":true,"test":false},"features":[],"filenames":["/home/tabby/rust-projects/aoc-0/target/debug/deps/libaoc_0-69efc4ff0b356e2c.rmeta"],"executable":null,"fresh":true}
{"reason":"compiler-artifact","package_id":"path+file:///home/tabby/rust-projects/aoc-0#0.1.0","manifest_path":"/home/tabby/rust-projects/aoc-0/Cargo.toml","target":{"kind":["bin"],"crate_types":["bin"],"name":"aoc-0","src_path":"/home/tabby/rust-projects/aoc-0/src/main.rs","edition":"2024","doc":true,"doctest":false,"test":true},"profile":{"opt_level":"0","debuginfo":2,"debug_assertions":true,"overflow_checks":true,"test":true},"features":[],"filenames":["/home/tabby/rust-projects/aoc-0/target/debug/deps/libaoc_0-1af2a37aa8c4259b.rmeta"],"executable":null,"fresh":true}
{"reason":"build-finished","success":true}

54
aoc-1/Cargo.lock generated Normal file
View file

@ -0,0 +1,54 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 4
[[package]]
name = "aho-corasick"
version = "1.1.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ddd31a130427c27518df266943a5308ed92d4b226cc639f5a8f1002816174301"
dependencies = [
"memchr",
]
[[package]]
name = "aoc-1"
version = "0.1.0"
dependencies = [
"regex",
]
[[package]]
name = "memchr"
version = "2.7.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f52b00d39961fc5b2736ea853c9cc86238e165017a493d1d5c8eac6bdc4cc273"
[[package]]
name = "regex"
version = "1.12.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "843bc0191f75f3e22651ae5f1e72939ab2f72a4bc30fa80a066bd66edefc24d4"
dependencies = [
"aho-corasick",
"memchr",
"regex-automata",
"regex-syntax",
]
[[package]]
name = "regex-automata"
version = "0.4.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5276caf25ac86c8d810222b3dbb938e512c55c6831a10f3e6ed1c93b84041f1c"
dependencies = [
"aho-corasick",
"memchr",
"regex-syntax",
]
[[package]]
name = "regex-syntax"
version = "0.8.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7a2d987857b319362043e95f5353c0535c1f58eec5336fdfcf626430af7def58"

7
aoc-1/Cargo.toml Normal file
View file

@ -0,0 +1,7 @@
[package]
name = "aoc-1"
version = "0.1.0"
edition = "2024"
[dependencies]
regex = "1.12.2"

4531
aoc-1/src/input.txt Normal file

File diff suppressed because it is too large Load diff

60
aoc-1/src/main.rs Normal file
View file

@ -0,0 +1,60 @@
// goal, figure out how many times the safe lands on 0 when following the instructions (input)
// each line has a direction L (subtracts) or R (adds)
// wraps between 99 -> 0, 99+1 = 0, 0-1=99
// my soloution plan:
// read in each line of the file, keep a count, add for R, subtract for L
// after each line, if count%100=0 then we have hit 0, count that in a seperate counter
// can also determine the resultant position by doing a count%100 at the end, maybe thats the 2nd star?
// need to figure out:
// reading in the file
// getting the first letter of the string, getting the value
// basic variables
// okay part 1 done, moving onto part 2
// after each move, lets do a modulo 100, count the hits then add/subtract the hits * 100 to get us back within the 0-99 range
//making a part 2 folder now
use std::fs;
use regex::Regex;
fn main() {
println!("lets begin advent of code, challenge 1");
let mut safe_value = 50;
let mut zero_hits = 0;
let file_path = "src/input.txt";
for line in fs::read_to_string(file_path).unwrap().lines() {
// println!("{line}");
// get the letter and the number, put them in different variables
let re = Regex::new(r"(?<direction>[RL])(?<value>\d+)").unwrap();
let Some(caps) = re.captures(line) else{
println!("sad cat");
return;
};
// println!("The direction is: {}", &caps["direction"]);
// println!("The value is: {}", &caps["value"]);
if &caps["direction"] == "L"{
safe_value -= &caps["value"].parse::<i32>().unwrap();
}
else{
safe_value += &caps["value"].parse::<i32>().unwrap();
}
if safe_value%100 == 0{
zero_hits += 1;
}
}
let true_safe_value = safe_value%100;
println!("Final safe value: {true_safe_value}");
println!("Total zero hits: {zero_hits}")
// let contents = fs::read_to_string(file_path)
// .expect("Should have been able to read the file");
// println!("With text:\n{contents}");
}

View file

@ -0,0 +1 @@
{"rustc_fingerprint":640939955106008076,"outputs":{"11857020428658561806":{"success":true,"status":"","code":0,"stdout":"___\nlib___.rlib\nlib___.so\nlib___.so\nlib___.a\nlib___.so\n/home/tabby/.rustup/toolchains/stable-x86_64-unknown-linux-gnu\noff\npacked\nunpacked\n___\ndebug_assertions\npanic=\"unwind\"\nproc_macro\ntarget_abi=\"\"\ntarget_arch=\"x86_64\"\ntarget_endian=\"little\"\ntarget_env=\"gnu\"\ntarget_family=\"unix\"\ntarget_feature=\"fxsr\"\ntarget_feature=\"sse\"\ntarget_feature=\"sse2\"\ntarget_has_atomic=\"16\"\ntarget_has_atomic=\"32\"\ntarget_has_atomic=\"64\"\ntarget_has_atomic=\"8\"\ntarget_has_atomic=\"ptr\"\ntarget_os=\"linux\"\ntarget_pointer_width=\"64\"\ntarget_vendor=\"unknown\"\nunix\n","stderr":""},"17747080675513052775":{"success":true,"status":"","code":0,"stdout":"rustc 1.91.1 (ed61e7d7e 2025-11-07)\nbinary: rustc\ncommit-hash: ed61e7d7e242494fb7057f2657300d9e77bb4fcb\ncommit-date: 2025-11-07\nhost: x86_64-unknown-linux-gnu\nrelease: 1.91.1\nLLVM version: 21.1.2\n","stderr":""},"7971740275564407648":{"success":true,"status":"","code":0,"stdout":"___\nlib___.rlib\nlib___.so\nlib___.so\nlib___.a\nlib___.so\n/home/tabby/.rustup/toolchains/stable-x86_64-unknown-linux-gnu\noff\npacked\nunpacked\n___\ndebug_assertions\npanic=\"unwind\"\nproc_macro\ntarget_abi=\"\"\ntarget_arch=\"x86_64\"\ntarget_endian=\"little\"\ntarget_env=\"gnu\"\ntarget_family=\"unix\"\ntarget_feature=\"fxsr\"\ntarget_feature=\"sse\"\ntarget_feature=\"sse2\"\ntarget_has_atomic=\"16\"\ntarget_has_atomic=\"32\"\ntarget_has_atomic=\"64\"\ntarget_has_atomic=\"8\"\ntarget_has_atomic=\"ptr\"\ntarget_os=\"linux\"\ntarget_pointer_width=\"64\"\ntarget_vendor=\"unknown\"\nunix\n","stderr":""}},"successes":{}}

View file

@ -0,0 +1,3 @@
Signature: 8a477f597d28d172789f06886806bc55
# This file is a cache directory tag created by cargo.
# For information about cache directory tags see https://bford.info/cachedir/

View file

View file

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

View file

@ -0,0 +1 @@
34a78c7c31898a15

View file

@ -0,0 +1 @@
{"rustc":4826714390000139368,"features":"[\"perf-literal\", \"std\"]","declared_features":"[\"default\", \"logging\", \"perf-literal\", \"std\"]","target":7534583537114156500,"profile":15657897354478470176,"path":6763698495534538749,"deps":[[198136567835728122,"memchr",false,10800195991698271818]],"local":[{"CheckDepInfo":{"dep_info":"debug/.fingerprint/aho-corasick-6337c41848bb14b1/dep-lib-aho_corasick","checksum":false}}],"rustflags":[],"config":2069994364910194474,"compile_kind":0}

View file

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

View file

@ -0,0 +1 @@
72cd9a8323c0e29d

View file

@ -0,0 +1 @@
{"rustc":4826714390000139368,"features":"[\"perf-literal\", \"std\"]","declared_features":"[\"default\", \"logging\", \"perf-literal\", \"std\"]","target":7534583537114156500,"profile":2241668132362809309,"path":6763698495534538749,"deps":[[198136567835728122,"memchr",false,10010420604412349814]],"local":[{"CheckDepInfo":{"dep_info":"debug/.fingerprint/aho-corasick-cc2d4a24cbeb7e5b/dep-lib-aho_corasick","checksum":false}}],"rustflags":[],"config":2069994364910194474,"compile_kind":0}

View file

@ -0,0 +1 @@
4b0957dca8817cf5

View file

@ -0,0 +1 @@
{"rustc":4826714390000139368,"features":"[]","declared_features":"[]","target":17001764401890239371,"profile":17672942494452627365,"path":4942398508502643691,"deps":[],"local":[{"CheckDepInfo":{"dep_info":"debug/.fingerprint/aoc-1-2a40a3a76fdd0e4a/dep-bin-aoc-1","checksum":false}}],"rustflags":[],"config":2069994364910194474,"compile_kind":0}

View file

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

View file

@ -0,0 +1 @@
d36999b65b1dbf1b

View file

@ -0,0 +1 @@
{"rustc":4826714390000139368,"features":"[]","declared_features":"[]","target":17001764401890239371,"profile":17672942494452627365,"path":4942398508502643691,"deps":[[3056178850035811329,"regex",false,2981367687007547236]],"local":[{"CheckDepInfo":{"dep_info":"debug/.fingerprint/aoc-1-3af84dbb03112ac2/dep-bin-aoc-1","checksum":false}}],"rustflags":[],"config":2069994364910194474,"compile_kind":0}

View file

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

View file

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

View file

@ -0,0 +1 @@
d67711038a98c661

View file

@ -0,0 +1 @@
{"rustc":4826714390000139368,"features":"[]","declared_features":"[]","target":17001764401890239371,"profile":3316208278650011218,"path":4942398508502643691,"deps":[[3056178850035811329,"regex",false,2981367687007547236]],"local":[{"CheckDepInfo":{"dep_info":"debug/.fingerprint/aoc-1-3b48c61d65b3f38b/dep-test-bin-aoc-1","checksum":false}}],"rustflags":[],"config":2069994364910194474,"compile_kind":0}

View file

@ -0,0 +1 @@
aa310a4428155d5c

View file

@ -0,0 +1 @@
{"rustc":4826714390000139368,"features":"[]","declared_features":"[]","target":17001764401890239371,"profile":8731458305071235362,"path":4942398508502643691,"deps":[],"local":[{"CheckDepInfo":{"dep_info":"debug/.fingerprint/aoc-1-5a64ec0ee0f6aa75/dep-bin-aoc-1","checksum":false}}],"rustflags":[],"config":2069994364910194474,"compile_kind":0}

View file

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

View file

@ -0,0 +1 @@
ef33191456685fbd

View file

@ -0,0 +1 @@
{"rustc":4826714390000139368,"features":"[]","declared_features":"[]","target":17001764401890239371,"profile":8731458305071235362,"path":4942398508502643691,"deps":[[3056178850035811329,"regex",false,1166477748697468182]],"local":[{"CheckDepInfo":{"dep_info":"debug/.fingerprint/aoc-1-6dec7d735a992177/dep-bin-aoc-1","checksum":false}}],"rustflags":[],"config":2069994364910194474,"compile_kind":0}

View file

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

View file

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

View file

@ -0,0 +1 @@
986e071abf1a4078

View file

@ -0,0 +1 @@
{"rustc":4826714390000139368,"features":"[]","declared_features":"[]","target":17001764401890239371,"profile":3316208278650011218,"path":4942398508502643691,"deps":[],"local":[{"CheckDepInfo":{"dep_info":"debug/.fingerprint/aoc-1-b3892b0bec26579a/dep-test-bin-aoc-1","checksum":false}}],"rustflags":[],"config":2069994364910194474,"compile_kind":0}

View file

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

View file

@ -0,0 +1 @@
4aeec5550801e295

View file

@ -0,0 +1 @@
{"rustc":4826714390000139368,"features":"[\"alloc\", \"std\"]","declared_features":"[\"alloc\", \"core\", \"default\", \"libc\", \"logging\", \"rustc-dep-of-std\", \"std\", \"use_std\"]","target":11745930252914242013,"profile":15657897354478470176,"path":15716013217369519184,"deps":[],"local":[{"CheckDepInfo":{"dep_info":"debug/.fingerprint/memchr-56b6765756afb2c6/dep-lib-memchr","checksum":false}}],"rustflags":[],"config":2069994364910194474,"compile_kind":0}

View file

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

View file

@ -0,0 +1 @@
76cd3f928028ec8a

View file

@ -0,0 +1 @@
{"rustc":4826714390000139368,"features":"[\"alloc\", \"std\"]","declared_features":"[\"alloc\", \"core\", \"default\", \"libc\", \"logging\", \"rustc-dep-of-std\", \"std\", \"use_std\"]","target":11745930252914242013,"profile":2241668132362809309,"path":15716013217369519184,"deps":[],"local":[{"CheckDepInfo":{"dep_info":"debug/.fingerprint/memchr-716f0fe60b1a2f77/dep-lib-memchr","checksum":false}}],"rustflags":[],"config":2069994364910194474,"compile_kind":0}

View file

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

View file

@ -0,0 +1 @@
64afe9881df25f29

View file

@ -0,0 +1 @@
{"rustc":4826714390000139368,"features":"[\"default\", \"perf\", \"perf-backtrack\", \"perf-cache\", \"perf-dfa\", \"perf-inline\", \"perf-literal\", \"perf-onepass\", \"std\", \"unicode\", \"unicode-age\", \"unicode-bool\", \"unicode-case\", \"unicode-gencat\", \"unicode-perl\", \"unicode-script\", \"unicode-segment\"]","declared_features":"[\"default\", \"logging\", \"pattern\", \"perf\", \"perf-backtrack\", \"perf-cache\", \"perf-dfa\", \"perf-dfa-full\", \"perf-inline\", \"perf-literal\", \"perf-onepass\", \"std\", \"unicode\", \"unicode-age\", \"unicode-bool\", \"unicode-case\", \"unicode-gencat\", \"unicode-perl\", \"unicode-script\", \"unicode-segment\", \"unstable\", \"use_std\"]","target":5796931310894148030,"profile":10712413002018579216,"path":16605479687808068411,"deps":[[198136567835728122,"memchr",false,10010420604412349814],[3030539787503978792,"regex_automata",false,1997343864070065852],[14659614821474690979,"regex_syntax",false,12198213855520644452],[15324871377471570981,"aho_corasick",false,11376866867455642994]],"local":[{"CheckDepInfo":{"dep_info":"debug/.fingerprint/regex-58ac3800c315fb75/dep-lib-regex","checksum":false}}],"rustflags":[],"config":2069994364910194474,"compile_kind":0}

View file

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

View file

@ -0,0 +1 @@
168d820955293010

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