From 9da423ee61f684e8d8668fe95200a7fbe4ea14ad Mon Sep 17 00:00:00 2001 From: Izan Gil <66965250+SrIzan10@users.noreply.github.com> Date: Sun, 30 Nov 2025 23:25:35 +0100 Subject: [PATCH] chore: 2025 init --- .gitignore | 14 +++++++++- 2024/5/5.go | 69 ++++++++++++++++++++++++++++++++++++++++++++++++ 2025/Cargo.lock | 7 +++++ 2025/Cargo.toml | 6 +++++ 2025/src/main.rs | 3 +++ 5 files changed, 98 insertions(+), 1 deletion(-) create mode 100644 2024/5/5.go create mode 100644 2025/Cargo.lock create mode 100644 2025/Cargo.toml create mode 100644 2025/src/main.rs diff --git a/.gitignore b/.gitignore index ae40cea..b765e89 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,13 @@ -input.txt \ No newline at end of file +input.txt +2025/debug +2025/target + +# These are backup files generated by rustfmt +**/*.rs.bk + +# MSVC Windows builds of rustc generate these, which store debugging information +*.pdb + +# Generated by cargo mutants +# Contains mutation testing data +**/mutants.out*/ diff --git a/2024/5/5.go b/2024/5/5.go new file mode 100644 index 0000000..75dfffd --- /dev/null +++ b/2024/5/5.go @@ -0,0 +1,69 @@ +package main + +import ( + "fmt" + "os" + "strconv" + "strings" +) + +func p1(data []string) int { + +} + +/* func p2(data []string) int { + +} */ + +func main() { + data, err := os.ReadFile("input.txt") + if err != nil { + fmt.Println("File reading error", err) + return + } + lines := strings.Split(string(data), "\n") + + fmt.Println("Part 1:", p1(lines)) + // fmt.Println("Part 2:", p2(lines)) +} + +func getRulesAndUpdates(data []string) (map[int][]int, [][]int) { + rules := make(map[int][]int) + updates := make([][]int, 0) + for i := range updates { + updates[i] = make([]int, 0) + } + + isParsingRules := true + for _, line := range data { + if line == "" { + isParsingRules = false + continue + } + + if isParsingRules { + splitted := strings.Split(line, "|") + + left, _ := strconv.Atoi(splitted[0]) + right, _ := strconv.Atoi(splitted[1]) + + rules[left] = append(rules[left], right) + } else { + splits := strings.Split(line, ",") + update := make([]int, 0, len(splits)) + + for _, i := range splits { + n, _ := strconv.Atoi(i) + + update = append(update, n) + } + + updates = append(updates, update) + } + } + return rules, updates +} + +func calc(rules map[int][]int, updates [][]int) { + +} \ No newline at end of file diff --git a/2025/Cargo.lock b/2025/Cargo.lock new file mode 100644 index 0000000..25df959 --- /dev/null +++ b/2025/Cargo.lock @@ -0,0 +1,7 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 4 + +[[package]] +name = "aoc2025" +version = "0.1.0" diff --git a/2025/Cargo.toml b/2025/Cargo.toml new file mode 100644 index 0000000..cfe6cd5 --- /dev/null +++ b/2025/Cargo.toml @@ -0,0 +1,6 @@ +[package] +name = "aoc2025" +version = "0.1.0" +edition = "2024" + +[dependencies] diff --git a/2025/src/main.rs b/2025/src/main.rs new file mode 100644 index 0000000..e7a11a9 --- /dev/null +++ b/2025/src/main.rs @@ -0,0 +1,3 @@ +fn main() { + println!("Hello, world!"); +}