aoc2024/day-06/internal/one/graph.go

29 lines
437 B
Go

package one
import (
"strings"
)
type graph struct {
startPoint point
data []string
}
func newGraph() *graph {
return &graph{}
}
func (g *graph) String() string {
return strings.Join(g.data, "\n")
}
func (g *graph) debug(visited map[coords]struct{}) string {
for loc := range visited {
if !(rune(g.data[loc.Y][loc.X]) == 'O') {
g.data[loc.Y] = replaceAtIndex(g.data[loc.Y], '+', loc.X)
}
}
return g.String()
}