Files
AdventOfCode/2018/day_10/main.go
2020-12-25 23:50:29 +01:00

34 lines
437 B
Go

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)
}
}