37 lines
660 B
Go
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"
|
|
}
|