2024-12-01 17:50:02 +00:00
|
|
|
/********************************************************************************
|
|
|
|
Advent of Code 2024 - day-01
|
|
|
|
********************************************************************************/
|
|
|
|
|
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
2024-12-02 00:23:59 +00:00
|
|
|
"embed"
|
2024-12-01 23:12:34 +00:00
|
|
|
"flag"
|
2024-12-01 17:50:02 +00:00
|
|
|
"fmt"
|
|
|
|
"log"
|
|
|
|
|
|
|
|
"github.com/onyx-and-iris/aoc2024/day-01/internal/one"
|
|
|
|
"github.com/onyx-and-iris/aoc2024/day-01/internal/two"
|
|
|
|
)
|
|
|
|
|
2024-12-02 00:23:59 +00:00
|
|
|
//go:embed testdata
|
|
|
|
var files embed.FS
|
|
|
|
|
2024-12-01 17:50:02 +00:00
|
|
|
func main() {
|
2024-12-01 23:12:34 +00:00
|
|
|
filename := flag.String("f", "input.txt", "input file")
|
|
|
|
flag.Parse()
|
|
|
|
|
2024-12-02 00:23:59 +00:00
|
|
|
data, err := files.ReadFile(fmt.Sprintf("testdata/%s", *filename))
|
|
|
|
if err != nil {
|
|
|
|
log.Fatal(err)
|
|
|
|
}
|
|
|
|
|
|
|
|
val, err := one.Solve(data)
|
2024-12-01 17:50:02 +00:00
|
|
|
if err != nil {
|
|
|
|
log.Fatal(err)
|
|
|
|
}
|
|
|
|
fmt.Printf("solution one: %d\n", val)
|
|
|
|
|
2024-12-02 00:23:59 +00:00
|
|
|
val, err = two.Solve(data)
|
2024-12-01 17:50:02 +00:00
|
|
|
if err != nil {
|
|
|
|
log.Fatal(err)
|
|
|
|
}
|
|
|
|
fmt.Printf("solution two: %d\n", val)
|
|
|
|
}
|