package main import ( "bufio" "fmt" "os" "aoc2022/day09/common" ) func main() { movements := common.Parse(*bufio.NewScanner(os.Stdin)) grid := common.NewGrid(10) visited := make(map[common.Position]struct{}) for _, movement := range movements { tailVisited := grid.Move(movement) for position := range tailVisited { visited[position] = struct{}{} } } fmt.Println(len(visited)) }