day 13 setup (incomplete)
Sorry, literally have no energy! Will attempt tomorrow
This commit is contained in:
		
							
								
								
									
										3
									
								
								day13/day 13a/go.mod
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										3
									
								
								day13/day 13a/go.mod
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,3 @@
 | 
			
		||||
module PWD
 | 
			
		||||
 | 
			
		||||
go 1.17
 | 
			
		||||
							
								
								
									
										40
									
								
								day13/day 13a/main.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										40
									
								
								day13/day 13a/main.go
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,40 @@
 | 
			
		||||
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
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										21
									
								
								day13/day 13a/testInput
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										21
									
								
								day13/day 13a/testInput
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,21 @@
 | 
			
		||||
6,10
 | 
			
		||||
0,14
 | 
			
		||||
9,10
 | 
			
		||||
0,3
 | 
			
		||||
10,4
 | 
			
		||||
4,11
 | 
			
		||||
6,0
 | 
			
		||||
6,12
 | 
			
		||||
4,1
 | 
			
		||||
0,13
 | 
			
		||||
10,12
 | 
			
		||||
3,4
 | 
			
		||||
3,0
 | 
			
		||||
8,4
 | 
			
		||||
1,10
 | 
			
		||||
2,14
 | 
			
		||||
8,10
 | 
			
		||||
9,0
 | 
			
		||||
 | 
			
		||||
fold along y=7
 | 
			
		||||
fold along x=5
 | 
			
		||||
		Reference in New Issue
	
	Block a user