Skip to main content

Module day09

Module day09 

Source
Expand description

ยงRope Bridge

This solution relies on the Point utility module. Two dimensional problems are common in Advent of Code, so having a decent Point (or Coord or Pos) implementation is convenient.

Functionsยง

parse
Converts input lines into a pair of Point and integer amount, to indicate direction and magnitude respectively. Then determines the maximum extent of the head so that we can allocate a two-dimensional grid.
part1
Simulate a rope length of 2.
part2
Simulate a rope length of 10.
simulate ๐Ÿ”’
Simulates a rope of arbitrary length.

Type Aliasesยง

Input ๐Ÿ”’
Pair ๐Ÿ”’