Commit Diff


commit - ca26da6b3bac2bba4c887c1ba624e3c399eb2b1b
commit + 517dede130b3a73459fd5723102262b99d12419d
blob - c1f4b75fa4bb1990d8052a3ceeff7ee402255b20
blob + c67609d3f95deebf81450cc54ea1cd2a87bba920
--- 2024/01.odin
+++ 2024/01.odin
@@ -1,7 +1,7 @@
 package aoc
 
-import "core:math"
 import "core:fmt"
+import "core:math"
 import "core:sort"
 import "core:strconv"
 import "core:strings"
@@ -18,24 +18,25 @@ day01 :: proc() {
 		b, _ := strconv.parse_int(sp[1])
 		append(&left, a)
 		append(&right, b)
+		delete(sp)
 	}
 	sort.quick_sort(left[:])
 	sort.quick_sort(right[:])
-	
+
 	p1: int
-	for i in 0..<len(left) {
-	    p1 += math.abs(left[i] - right[i])
+	for i in 0 ..< len(left) {
+		p1 += math.abs(left[i] - right[i])
 	}
 	fmt.println(p1)
-	
+
 	count: map[int]int
 	for r in right {
-	    count[r] += 1
+		count[r] += 1
 	}
- 
+
 	p2: int
 	for l in left {
-	    p2 += l * count[l]
+		p2 += l * count[l]
 	}
 	fmt.println(p2)
 }
blob - 0a67c54bb0d465f686b9f70cde97bac9ce5446d1
blob + a72f56b94509de8f45a277358af48730ef3bf176
--- 2024/02.odin
+++ 2024/02.odin
@@ -5,9 +5,10 @@ import "core:log"
 import "core:os"
 
 day02 :: proc() {
-	input, ok := os.read_entire_file("input/01")
-	if !ok {
-		log.fatal("Failed to read input")
+    input := slurp_lines("input/02")
+	defer delete(input)
+	
+	for line in input {
+	    
 	}
-	fmt.println("Solution for Day 02 is not implemented yet")
 }
blob - 43a7afb26830e88723082186a6f0802a50a099f0
blob + 9db74930619f40f10baa5de97084e636f4af8a25
--- 2024/03.odin
+++ 2024/03.odin
@@ -5,9 +5,7 @@ import "core:log"
 import "core:os"
 
 day03 :: proc() {
-	input, ok := os.read_entire_file("input/01")
-	if !ok {
-		log.fatal("Failed to read input")
-	}
+    input := slurp_lines("input/03")
+	defer delete(input)
 	fmt.println("Solution for Day 03 is not implemented yet")
 }
blob - 6ac5406a3b12706aa6758b00456d8c183116eec6
blob + b975f036235581a8610c8467346c85b7b10782d3
--- 2024/04.odin
+++ 2024/04.odin
@@ -5,9 +5,7 @@ import "core:log"
 import "core:os"
 
 day04 :: proc() {
-	input, ok := os.read_entire_file("input/01")
-	if !ok {
-		log.fatal("Failed to read input")
-	}
+    input := slurp_lines("input/04")
+	defer delete(input)
 	fmt.println("Solution for Day 04 is not implemented yet")
 }
blob - a53fb19a51c06207369de5ff11418db989e1145a
blob + a524c9db7d611021d3c34e6e750c19bc45b5f33b
--- 2024/05.odin
+++ 2024/05.odin
@@ -5,9 +5,7 @@ import "core:log"
 import "core:os"
 
 day05 :: proc() {
-	input, ok := os.read_entire_file("input/01")
-	if !ok {
-		log.fatal("Failed to read input")
-	}
+    input := slurp_lines("input/05")
+	defer delete(input)
 	fmt.println("Solution for Day 05 is not implemented yet")
 }
blob - 3dacded3efdbd4333f438c677ee9e9b0a6180ca9
blob + f617be0bdbc325d59fbe5e13e39ca0a834f23a3d
--- 2024/06.odin
+++ 2024/06.odin
@@ -5,9 +5,7 @@ import "core:log"
 import "core:os"
 
 day06 :: proc() {
-	input, ok := os.read_entire_file("input/01")
-	if !ok {
-		log.fatal("Failed to read input")
-	}
+    input := slurp_lines("input/06")
+	defer delete(input)
 	fmt.println("Solution for Day 06 is not implemented yet")
 }
blob - 22f452d693642ad10349e6662fa16823dc0e28b2
blob + 8f741b761b2736e4fbd5ab40074b9e587c83ff89
--- 2024/07.odin
+++ 2024/07.odin
@@ -5,9 +5,7 @@ import "core:log"
 import "core:os"
 
 day07 :: proc() {
-	input, ok := os.read_entire_file("input/01")
-	if !ok {
-		log.fatal("Failed to read input")
-	}
+    input := slurp_lines("input/07")
+	defer delete(input)
 	fmt.println("Solution for Day 07 is not implemented yet")
 }
blob - b97417239bf056a2cf49776833d19c5710697f15
blob + ed5cddbfc3fc46aa35db4bc9f4999c199bf3be15
--- 2024/08.odin
+++ 2024/08.odin
@@ -5,9 +5,7 @@ import "core:log"
 import "core:os"
 
 day08 :: proc() {
-	input, ok := os.read_entire_file("input/01")
-	if !ok {
-		log.fatal("Failed to read input")
-	}
+    input := slurp_lines("input/08")
+	defer delete(input)
 	fmt.println("Solution for Day 08 is not implemented yet")
 }
blob - 04c0d1d769e5b0cbc15b0e052ba8b2d270024f7a
blob + 643acc00b254bd03a8b936cea21c89e92bd12e9d
--- 2024/09.odin
+++ 2024/09.odin
@@ -5,9 +5,7 @@ import "core:log"
 import "core:os"
 
 day09 :: proc() {
-	input, ok := os.read_entire_file("input/01")
-	if !ok {
-		log.fatal("Failed to read input")
-	}
+    input := slurp_lines("input/09")
+	defer delete(input)
 	fmt.println("Solution for Day 09 is not implemented yet")
 }
blob - 49548316ca720d738734a72e7bb4a1fe87296960
blob + f0671d407c2c2fc516cb8f4c177bef167d74e705
--- 2024/10.odin
+++ 2024/10.odin
@@ -5,9 +5,7 @@ import "core:log"
 import "core:os"
 
 day10 :: proc() {
-	input, ok := os.read_entire_file("input/01")
-	if !ok {
-		log.fatal("Failed to read input")
-	}
+    input := slurp_lines("input/10")
+	defer delete(input)
 	fmt.println("Solution for Day 10 is not implemented yet")
 }
blob - 183485394071c5275e380a100e23157d4145e957
blob + ea5bf1a93ba414387d8466b090701ae345724901
--- 2024/11.odin
+++ 2024/11.odin
@@ -5,9 +5,7 @@ import "core:log"
 import "core:os"
 
 day11 :: proc() {
-	input, ok := os.read_entire_file("input/01")
-	if !ok {
-		log.fatal("Failed to read input")
-	}
+    input := slurp_lines("input/11")
+	defer delete(input)
 	fmt.println("Solution for Day 11 is not implemented yet")
 }
blob - bedb25bf59dff8fcd2f0cbf5dcb821efeda5a254
blob + dbc1a206e995dec880e631f4e1c0855a68f31473
--- 2024/12.odin
+++ 2024/12.odin
@@ -5,9 +5,7 @@ import "core:log"
 import "core:os"
 
 day12 :: proc() {
-	input, ok := os.read_entire_file("input/01")
-	if !ok {
-		log.fatal("Failed to read input")
-	}
+    input := slurp_lines("input/12")
+	defer delete(input)
 	fmt.println("Solution for Day 12 is not implemented yet")
 }
blob - 49257da57ba0404997b230faebbfadc5a86bcbdf
blob + 50558f6c8cf0a70d5b6e0832e321f8789081049b
--- 2024/13.odin
+++ 2024/13.odin
@@ -5,9 +5,7 @@ import "core:log"
 import "core:os"
 
 day13 :: proc() {
-	input, ok := os.read_entire_file("input/01")
-	if !ok {
-		log.fatal("Failed to read input")
-	}
+    input := slurp_lines("input/13")
+	defer delete(input)
 	fmt.println("Solution for Day 13 is not implemented yet")
 }
blob - cb304cdccd1e7d4298b0ef346add35520ca8afa8
blob + 685c0a28f0f303c3047444f1e84e327163072b03
--- 2024/14.odin
+++ 2024/14.odin
@@ -5,9 +5,7 @@ import "core:log"
 import "core:os"
 
 day14 :: proc() {
-	input, ok := os.read_entire_file("input/01")
-	if !ok {
-		log.fatal("Failed to read input")
-	}
+    input := slurp_lines("input/14")
+	defer delete(input)
 	fmt.println("Solution for Day 14 is not implemented yet")
 }
blob - a05f98829a00573006a3d4ee22c032d8a944b30b
blob + 5e4a2d8761bbef82394eac1ea5bf176c5a6c77ed
--- 2024/15.odin
+++ 2024/15.odin
@@ -5,9 +5,7 @@ import "core:log"
 import "core:os"
 
 day15 :: proc() {
-	input, ok := os.read_entire_file("input/01")
-	if !ok {
-		log.fatal("Failed to read input")
-	}
+    input := slurp_lines("input/15")
+	defer delete(input)
 	fmt.println("Solution for Day 15 is not implemented yet")
 }
blob - bbe8863e5ee27c6f2afc1c4ea70bf97374a0aaa8
blob + e1f62e553582ea803612537b72b463f590481e01
--- 2024/16.odin
+++ 2024/16.odin
@@ -5,9 +5,7 @@ import "core:log"
 import "core:os"
 
 day16 :: proc() {
-	input, ok := os.read_entire_file("input/01")
-	if !ok {
-		log.fatal("Failed to read input")
-	}
+    input := slurp_lines("input/16")
+	defer delete(input)
 	fmt.println("Solution for Day 16 is not implemented yet")
 }
blob - 2d641e5647a525bd498ff4c1cb500e633401147b
blob + 6cc32ece713abb89b7554bbf5e1bac404976156c
--- 2024/17.odin
+++ 2024/17.odin
@@ -5,9 +5,7 @@ import "core:log"
 import "core:os"
 
 day17 :: proc() {
-	input, ok := os.read_entire_file("input/01")
-	if !ok {
-		log.fatal("Failed to read input")
-	}
+    input := slurp_lines("input/17")
+	defer delete(input)
 	fmt.println("Solution for Day 17 is not implemented yet")
 }
blob - e67edaf1eb7433bc63749081505bf44cd7102d43
blob + a3e74768549cf7326cad620203dab6c5f10ec23a
--- 2024/18.odin
+++ 2024/18.odin
@@ -5,9 +5,7 @@ import "core:log"
 import "core:os"
 
 day18 :: proc() {
-	input, ok := os.read_entire_file("input/01")
-	if !ok {
-		log.fatal("Failed to read input")
-	}
+    input := slurp_lines("input/18")
+	defer delete(input)
 	fmt.println("Solution for Day 18 is not implemented yet")
 }
blob - ecad6ff16e4dddfa7ece3d974dfa6d2206ba866a
blob + f3f552e02affc1aa139b76ce44a810c8ba2d3c27
--- 2024/19.odin
+++ 2024/19.odin
@@ -5,9 +5,7 @@ import "core:log"
 import "core:os"
 
 day19 :: proc() {
-	input, ok := os.read_entire_file("input/01")
-	if !ok {
-		log.fatal("Failed to read input")
-	}
+    input := slurp_lines("input/19")
+	defer delete(input)
 	fmt.println("Solution for Day 19 is not implemented yet")
 }
blob - b9749168e3e85251b845b1ad8d40311ddb350eeb
blob + b6f48a126a5aed47105a2690d38a957ba2eacff7
--- 2024/20.odin
+++ 2024/20.odin
@@ -5,9 +5,7 @@ import "core:log"
 import "core:os"
 
 day20 :: proc() {
-	input, ok := os.read_entire_file("input/01")
-	if !ok {
-		log.fatal("Failed to read input")
-	}
+    input := slurp_lines("input/20")
+	defer delete(input)
 	fmt.println("Solution for Day 20 is not implemented yet")
 }
blob - 8ed218dbc3ed1451180a30a57f25946b27211c82
blob + 755f37283e8a9bca1d14379f0ad73a10e92092c8
--- 2024/21.odin
+++ 2024/21.odin
@@ -5,9 +5,7 @@ import "core:log"
 import "core:os"
 
 day21 :: proc() {
-	input, ok := os.read_entire_file("input/01")
-	if !ok {
-		log.fatal("Failed to read input")
-	}
+    input := slurp_lines("input/21")
+	defer delete(input)
 	fmt.println("Solution for Day 21 is not implemented yet")
 }
blob - a0e3dff947608fb31817aba7d6565030462d3fd3
blob + 9a071806fbe635d75da8841ac357915907cbd743
--- 2024/22.odin
+++ 2024/22.odin
@@ -5,9 +5,7 @@ import "core:log"
 import "core:os"
 
 day22 :: proc() {
-	input, ok := os.read_entire_file("input/01")
-	if !ok {
-		log.fatal("Failed to read input")
-	}
+    input := slurp_lines("input/22")
+	defer delete(input)
 	fmt.println("Solution for Day 22 is not implemented yet")
 }
blob - a6d1af4e2e0b55943cce378d7dee200e4784c056
blob + e0d299f9205452ab3461003e149c534f9138315e
--- 2024/23.odin
+++ 2024/23.odin
@@ -5,9 +5,7 @@ import "core:log"
 import "core:os"
 
 day23 :: proc() {
-	input, ok := os.read_entire_file("input/01")
-	if !ok {
-		log.fatal("Failed to read input")
-	}
+    input := slurp_lines("input/23")
+	defer delete(input)
 	fmt.println("Solution for Day 23 is not implemented yet")
 }
blob - 97adce037d893334789cbe09e9069ec5525eb5c8
blob + 7358f0483183be75c4d88627893ffffff2d08341
--- 2024/24.odin
+++ 2024/24.odin
@@ -5,9 +5,7 @@ import "core:log"
 import "core:os"
 
 day24 :: proc() {
-	input, ok := os.read_entire_file("input/01")
-	if !ok {
-		log.fatal("Failed to read input")
-	}
+    input := slurp_lines("input/24")
+	defer delete(input)
 	fmt.println("Solution for Day 24 is not implemented yet")
 }
blob - 1dfb334a5e62bbc61fe2ee4f133d5cf7882f437a
blob + e98d324d7da020287ba62c1d28acfc4fbe8cb453
--- 2024/25.odin
+++ 2024/25.odin
@@ -5,9 +5,7 @@ import "core:log"
 import "core:os"
 
 day25 :: proc() {
-	input, ok := os.read_entire_file("input/01")
-	if !ok {
-		log.fatal("Failed to read input")
-	}
+    input := slurp_lines("input/25")
+	defer delete(input)
 	fmt.println("Solution for Day 25 is not implemented yet")
 }
blob - f6c92a6021b1664d696db15abf1c0b9b8572bf58 (mode 755)
blob + /dev/null
--- 2024/generator.sh
+++ /dev/null
@@ -1,24 +0,0 @@
-#!/usr/bin/env bash
-
-for day in {1..25}; do
-  if [[ $day -lt 10 ]]; then
-    d="0${day}"
-  else
-    d="$day"
-  fi
-  tee "${d}.odin" <<EOF
-package aoc
-
-import "core:fmt"
-import "core:log"
-import "core:os"
-
-day${d} :: proc() {
-	input, ok := os.read_entire_file("input/01")
-	if !ok {
-		log.fatal("Failed to read input")
-	}
-	fmt.println("Solution for Day ${d} is not implemented yet")
-}
-EOF
-done