From fb896a8d208561293a7d1a1aad32a3d55c26b86c Mon Sep 17 00:00:00 2001 From: Davide Oddone Date: Tue, 12 Dec 2023 19:17:01 +0100 Subject: [PATCH] Starting day10 --- day10/maze.go | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/day10/maze.go b/day10/maze.go index 11194e8..d94bac0 100644 --- a/day10/maze.go +++ b/day10/maze.go @@ -1,11 +1,17 @@ package main -import() +import ( + "bufio" + "fmt" + "os" + "sync" + "time" +) // Parallel code, global vars type Nodes struct { - mu sync.Mutex - variable type + mu sync.Mutex + variable int } func check(e error) { @@ -18,6 +24,7 @@ func PrintAndWait(x ...any) { fmt.Print(x...) fmt.Scanln() } + // use defer timer("funcname")() when the function you want to // test starts func timer(name string) func() { @@ -31,12 +38,11 @@ func main() { file, err := os.Open("./inputs") check(err) defer file.Close() - + lines := make([]string, 0) - + scanner := bufio.NewScanner(file) for scanner.Scan() { - lines = append(lines, scanner.Text()) + lines = append(lines, scanner.Text()) } - -} +}