mirror of
https://github.com/onyx-and-iris/aoc2024.git
synced 2026-04-09 02:23:36 +00:00
remove internal/util
This commit is contained in:
@@ -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()
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user