Day10 skeleton
This commit is contained in:
parent
6d24500c69
commit
5bebd71c4e
1
day10/inputs
Symbolic link
1
day10/inputs
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
../inputs
|
||||||
42
day10/maze.go
Normal file
42
day10/maze.go
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
import()
|
||||||
|
|
||||||
|
// Parallel code, global vars
|
||||||
|
type Nodes struct {
|
||||||
|
mu sync.Mutex
|
||||||
|
variable type
|
||||||
|
}
|
||||||
|
|
||||||
|
func check(e error) {
|
||||||
|
if e != nil {
|
||||||
|
panic(e)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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() {
|
||||||
|
start := time.Now()
|
||||||
|
return func() {
|
||||||
|
fmt.Printf("%s took %v\n", name, time.Since(start))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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())
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user