package two import ( "slices" "strings" "github.com/onyx-and-iris/aoc2024/day-20/internal/point" "github.com/elliotchance/orderedmap/v3" ) type graph struct { start, end point.Point data []string } func newGraph(data []string) *graph { return &graph{data: data} } func (g *graph) String() string { return strings.Join(g.data, "\n") } func (g *graph) valueAt(p point.Point) rune { return rune(g.data[p.Y][p.X]) } func (g *graph) debug(path *orderedmap.OrderedMap[point.Point, int]) string { temp := slices.Clone(g.data) for n := range path.Keys() { if g.valueAt(n) == 'X' { continue } temp[n.Y] = replaceAtIndex(temp[n.Y], 'O', n.X) } return strings.Join(temp, "\n") }