remove internal/util

This commit is contained in:
2025-01-07 17:24:01 +00:00
parent 2b675af081
commit 84c1013f2c
6 changed files with 20 additions and 20 deletions

View File

@@ -2,8 +2,6 @@ package one
import (
"strings"
"github.com/onyx-and-iris/aoc2024/day-08/internal/util"
)
type graph struct {
@@ -26,10 +24,10 @@ func (g *graph) isOutOfBounds(c coords) bool {
func (g *graph) debug() string {
for _, antenna := range g.antennae {
g.data[antenna.y] = util.ReplaceAtIndex(g.data[antenna.y], antenna.identifier, antenna.x)
g.data[antenna.y] = replaceAtIndex(g.data[antenna.y], antenna.identifier, antenna.x)
}
for antinode := range g.antinodes {
g.data[antinode.y] = util.ReplaceAtIndex(g.data[antinode.y], '#', antinode.x)
g.data[antinode.y] = replaceAtIndex(g.data[antinode.y], '#', antinode.x)
}
return g.String()

View File

@@ -32,3 +32,9 @@ func parseLines(r io.Reader) (*graph, error) {
return graph, nil
}
func replaceAtIndex(s string, r rune, i int) string {
out := []rune(s)
out[i] = r
return string(out)
}