day3, part1
This commit is contained in:
@@ -8,7 +8,7 @@ import (
|
||||
)
|
||||
|
||||
func Run() int {
|
||||
filename := "day3/example"
|
||||
filename := "day3/input"
|
||||
bytes, err := os.ReadFile(filename)
|
||||
if err != nil {
|
||||
panic(fmt.Sprint(err, filename))
|
||||
@@ -20,7 +20,9 @@ func Run() int {
|
||||
fmt.Println(matrix.String())
|
||||
|
||||
numbers := ReadNumbers(&matrix)
|
||||
fmt.Println(numbers)
|
||||
for _, num := range numbers {
|
||||
fmt.Println(num)
|
||||
}
|
||||
|
||||
partNumbersSum := 0
|
||||
for _, num := range numbers {
|
||||
@@ -114,7 +116,7 @@ func ReadNumbers(m *Matrix) []MatrixNumber {
|
||||
|
||||
// now let's check for special symbols around and save them
|
||||
}
|
||||
if symb == '.' {
|
||||
if !unicode.IsDigit(symb) {
|
||||
if curNum != nil {
|
||||
res = append(res, *curNum)
|
||||
curNum = nil
|
||||
|
||||
Reference in New Issue
Block a user