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

29 lines
437 B
Go
Raw Normal View History

2024-12-06 20:01:17 +00:00
package one
import (
"strings"
)
type graph struct {
startPoint point
data []string
2024-12-06 20:01:17 +00:00
}
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') {
2025-01-07 17:23:11 +00:00
g.data[loc.Y] = replaceAtIndex(g.data[loc.Y], '+', loc.X)
2024-12-06 20:01:17 +00:00
}
}
return g.String()
}