day2
This commit is contained in:
@@ -21,7 +21,7 @@ func ToInts(input string, sep string) []int {
|
||||
func ToGrid2D[T any](input, rowSep, colSep string, empty T, conv func(string) T) *grid2d.Grid[T] {
|
||||
lines := strings.Split(input, rowSep)
|
||||
|
||||
grid := grid2d.NewGrid(len(lines[0]), len(lines), empty)
|
||||
grid := grid2d.NewGrid(len(lines[0]) - strings.Count(lines[0], colSep), len(lines), empty)
|
||||
for y, line := range lines {
|
||||
for x, v := range strings.Split(line, colSep) {
|
||||
grid.Set(x, y, conv(v))
|
||||
|
||||
Reference in New Issue
Block a user