mirror of
https://github.com/onyx-and-iris/aoc2024.git
synced 2025-01-10 06:40:47 +00:00
31 lines
500 B
Go
31 lines
500 B
Go
package one
|
|
|
|
import (
|
|
"strings"
|
|
|
|
"github.com/onyx-and-iris/aoc2024/day-06/internal/util"
|
|
)
|
|
|
|
type graph struct {
|
|
data []string
|
|
startPoint point
|
|
}
|
|
|
|
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] = util.ReplaceAtIndex(g.data[loc.Y], '+', loc.X)
|
|
}
|
|
}
|
|
|
|
return g.String()
|
|
}
|