AdventOfCode2021/day13/day 13b/main.go
Luke Else 5031559529 day 13 setup (incomplete)
Sorry, literally have no energy! Will attempt tomorrow
2021-12-13 20:53:55 +00:00

41 lines
652 B
Go

package main
import (
"bufio"
"fmt"
"os"
"strconv"
)
func main() {
content := returnContent("../input")
//content := returnContent("testInput")
}
func returnContent(path string) *[][]int {
//read file and return it as an array of integers
file, err := os.Open(path)
var content [][]int
if err != nil {
fmt.Println("Unlucky, the file didn't open")
return &content
}
defer file.Close()
scanner := bufio.NewScanner(file)
for scanner.Scan() {
nums := []int{}
for _, char := range scanner.Text() {
num, _ := strconv.Atoi(string(char))
nums = append(nums, num)
}
content = append(content, nums)
}
return &content
}