This commit is contained in:
2022-12-08 11:07:30 +01:00
parent accef506b5
commit c9a854978a
3 changed files with 146 additions and 0 deletions

25
day08/common/forest.go Normal file
View File

@@ -0,0 +1,25 @@
package common
import (
"bufio"
)
type Tree int
type Forest [][]Tree
func Parse(scanner bufio.Scanner) Forest {
forest := Forest{}
for scanner.Scan() {
line := scanner.Text()
forestRow := make([]Tree, len(line))
for i, character := range line {
forestRow[i] = Tree(character - '0')
}
forest = append(forest, forestRow)
}
return forest
}