day23: started hardcode of part2, way too slow

This commit is contained in:
efim
2023-12-23 10:19:25 +00:00
parent 44de1377ca
commit 7ebb6dee2c
4 changed files with 101 additions and 2 deletions

View File

@@ -1,6 +1,8 @@
package day23
import (
"log"
mapset "github.com/deckarep/golang-set/v2"
)
@@ -10,7 +12,7 @@ type PathEnd struct {
}
func ExtendPath(p PathEnd, f Field) (nextPaths []PathEnd) {
endPointNeighbors := f.Neighbors(p.end)
endPointNeighbors := f.NeighborsPart2(p.end)
for _, potentialNewEnd := range endPointNeighbors {
if !p.visited.Contains(potentialNewEnd) {
nextVisited := p.visited.Clone()
@@ -39,6 +41,7 @@ func RunAllScenicPaths(f Field) (result []PathEnd) {
if curCheckedPath.end == theEndCoord {
result = append(result, curCheckedPath)
log.Printf("found end path of len %d . %+v", curCheckedPath.visited.Cardinality(), curCheckedPath)
continue
}