port_intersection: Port Intersection

Description Usage Arguments Examples

View source: R/port_intersection.R

Description

The wires twist and turn, but the two wires occasionally cross paths. To fix the circuit, you need to find the intersection point closest to the central port. Because the wires are on a grid, use the Manhattan distance for this measurement. While the wires do technically cross right at the central port where they both start, this point does not count, nor does a wire count as crossing with itself.

Usage

1
port_intersection(wire1, wire2, use_time = FALSE)

Arguments

wire1, wire2

A character vector of wires

use_time

A logical should the answer return time or manhatan distance

Examples

1
2
port_intersection(day_3[[1]], day_3[[2]])
port_intersection(day_3[[1]], day_3[[2]], use_time = TRUE)

denrou/adventofcode2019 documentation built on Dec. 7, 2019, 12:25 a.m.