Files

45 lines
791 B
Go
Raw Permalink Normal View History

2025-11-28 07:19:14 -06:00
package main
2025-12-01 06:49:26 -06:00
import (
"github.com/StevanFreeborn/advent-of-code-2025/cmd/01/dial"
"github.com/StevanFreeborn/advent-of-code-2025/cmd/01/instruction"
"github.com/StevanFreeborn/advent-of-code-2025/internal/file"
)
2025-11-28 07:19:14 -06:00
func SolvePartOne(filePath string) int {
lines := file.ReadAllLines(filePath)
2025-12-01 06:49:26 -06:00
dial := dial.New()
total := 0
for _, line := range lines {
if line == "" {
continue
}
instruction := instruction.FromLine(line)
dial.Turn(instruction)
if dial.Value() == 0 {
total++
}
}
return total
2025-11-28 07:19:14 -06:00
}
2025-12-02 07:18:38 -06:00
func SolvePartTwo(filePath string) int {
lines := file.ReadAllLines(filePath)
2025-12-02 07:18:38 -06:00
dial := dial.New()
for _, line := range lines {
if line == "" {
continue
}
instruction := instruction.FromLine(line)
dial.Turn(instruction)
}
return dial.ZeroCount()
}