adventofcode/2018/day01-2.go

26 lines
408 B
Go

package main
import (
"fmt"
"os"
"internal/day01"
)
// Provide a filename as input, get the result on stdout
func main() {
x := 0
found := false
seen := day01.Set{0: struct{}{}}
for {
x, found = day01.ScanFrequencies(os.Args[1], &seen, x)
if found {
break
}
fmt.Println("All frequencies scanned, repeating...")
}
fmt.Println("Repeat frequency detected, calibration complete: ", x)
}