This commit is contained in:
Simon Ziegler
2025-12-01 15:03:10 +01:00
parent 35f75813de
commit 15935d3f23
5 changed files with 4531 additions and 0 deletions

3
01/go.mod Normal file
View File

@@ -0,0 +1,3 @@
module git.z1glr.de/advent-of-code-2025/01
go 1.25.4

4462
01/input Normal file

File diff suppressed because it is too large Load Diff

54
01/main.go Normal file
View File

@@ -0,0 +1,54 @@
package main
import (
"fmt"
"os"
"strconv"
"strings"
)
func main() {
if bytes, err := os.ReadFile("input"); err != nil {
panic(err)
} else {
content := strings.TrimSpace(string(bytes))
turns := strings.SplitSeq(content, "\n")
position := 50
zeroCount := 0
zeroPasses := 0
for turn := range turns {
left := turn[0] == 'L'
if steps, err := strconv.Atoi(strings.TrimSpace(turn[1:])); err != nil {
panic(err)
} else {
for range steps {
if left {
position--
} else {
position++
}
position = (position + 100) % 100
if position == 0 {
zeroPasses++
}
}
if position == 0 {
zeroCount++
}
fmt.Println()
}
}
fmt.Println(zeroCount)
fmt.Println(zeroPasses)
}
}

10
01/test Normal file
View File

@@ -0,0 +1,10 @@
L68
L30
R48
L5
R60
L55
L1
L99
R14
L82

2
01/wrongs Normal file
View File

@@ -0,0 +1,2 @@
6586
6350