mirror of
https://github.com/Noettore/AdventOfCode.git
synced 2025-10-15 03:36:39 +02:00
Previous years crap.
Signed-off-by: Ettore Dreucci <ettore.dreucci@gmail.com>
This commit is contained in:
33
2018/day_10/main.go
Normal file
33
2018/day_10/main.go
Normal file
@@ -0,0 +1,33 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"bufio"
|
||||
"fmt"
|
||||
"log"
|
||||
"os"
|
||||
)
|
||||
|
||||
type point struct {
|
||||
x, y int
|
||||
Vx, Vy int
|
||||
}
|
||||
|
||||
func main() {
|
||||
var points []*point
|
||||
|
||||
file, err := os.Open("./input")
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
defer file.Close()
|
||||
|
||||
scan := bufio.NewScanner(file)
|
||||
for scan.Scan() {
|
||||
var p *point
|
||||
|
||||
line := scan.Text()
|
||||
fmt.Sscanf(line, "position=<%d, %d> velocity=<%d, %d>", &p.x, &p.y, &p.Vx, &p.Vy)
|
||||
|
||||
points = append(points, p)
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user