This commit is contained in:
2024-12-02 10:11:17 +00:00
parent 0034691f2a
commit ab9bdc63b1
5 changed files with 1139 additions and 1 deletions

View File

@@ -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))