aoc2015/day25/day.go
2021-10-24 12:32:52 +02:00

37 lines
660 B
Go

package day25
import (
"strconv"
"strings"
"tools"
)
func Part1(puzzle tools.AoCPuzzle) interface{} {
inputParts := strings.Split(puzzle.GetInputArray()[0], " ")
wantedX, _ := strconv.Atoi(inputParts[18][:len(inputParts[18])-1])
wantedY, _ := strconv.Atoi(inputParts[16][:len(inputParts[16])-1])
codeNumber := 20151125
x := 1
y := 1
maxY := 1
for {
codeNumber = codeNumber * 252533 % 33554393
y--
x++
if y == 0 {
y = maxY + 1
maxY = y
x = 1
}
if x == wantedX && y == wantedY {
return codeNumber
}
}
}
func Part2(puzzle tools.AoCPuzzle) interface{} {
return "d25p2 always only checks if you solved everything else"
}