mirror of
https://github.com/Noettore/AdventOfCode.git
synced 2025-10-14 19:26:39 +02:00
34 lines
437 B
Go
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)
|
|
}
|
|
}
|