day23: started hardcode of part2, way too slow
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user