aoc2024/day-04/internal/two/graph.go

18 lines
294 B
Go
Raw Normal View History

package two
type graph struct {
data []string
}
func newGraph() *graph {
return &graph{}
}
func (g *graph) valueAt(p point) rune {
return rune(g.data[p.y][p.x])
}
func (g *graph) isOutOfBounds(p point) bool {
return p.x < 0 || p.y < 0 || p.y >= len(g.data) || p.x >= len(g.data[p.y])
}