part2 (2594B)
1--- Part Two --- 2 3Before you can give the destination to the captain, you realize that the actual action meanings were 4printed on the back of the instructions the whole time. 5 6Almost all of the actions indicate how to move a [1m[37mwaypoint[0m which is relative to the 7ship's position: 8 9 10 - Action [1m[37mN[0m means to move the waypoint [1m[37mnorth[0m by the given value. 11 - Action [1m[37mS[0m means to move the waypoint [1m[37msouth[0m by the given value. 12 - Action [1m[37mE[0m means to move the waypoint [1m[37meast[0m by the given value. 13 - Action [1m[37mW[0m means to move the waypoint [1m[37mwest[0m by the given value. 14 - Action [1m[37mL[0m means to rotate the waypoint around the ship [1m[37mleft[0m 15([1m[37mcounter-clockwise[0m) the given number of degrees. 16 - Action [1m[37mR[0m means to rotate the waypoint around the ship [1m[37mright[0m 17([1m[37mclockwise[0m) the given number of degrees. 18 - Action [1m[37mF[0m means to move [1m[37mforward[0m to the waypoint a number of times equal 19to the given value. 20 21 22The waypoint starts [1m[37m10 units east and 1 unit north[0m relative to the ship. The waypoint 23is relative to the ship; that is, if the ship moves, the waypoint moves with it. 24 25For example, using the same instructions as above: 26 27 28 - F10 moves the ship to the waypoint 10 times (a total of [1m[37m100 units east and 10 units 29north[0m), leaving the ship at [1m[37meast 100, north 10[0m. The waypoint stays 10 units east 30and 1 unit north of the ship. 31 - N3 moves the waypoint 3 units north to [1m[37m10 units east and 4 units north of the ship[0m. 32The ship remains at [1m[37meast 100, north 10[0m. 33 - F7 moves the ship to the waypoint 7 times (a total of [1m[37m70 units east and 28 units 34north[0m), leaving the ship at [1m[37meast 170, north 38[0m. The waypoint stays 10 units east 35and 4 units north of the ship. 36 - R90 rotates the waypoint around the ship clockwise 90 degrees, moving it to [1m[37m4 units east 37and 10 units south of the ship[0m. The ship remains at [1m[37meast 170, north 38[0m. 38 - F11 moves the ship to the waypoint 11 times (a total of [1m[37m44 units east and 110 units 39south[0m), leaving the ship at [1m[37meast 214, south 72[0m. The waypoint stays 4 units east and 4010 units south of the ship. 41 42 43After these operations, the ship's Manhattan distance from its starting position is 214 + 72 = 44[1m[37m286[0m. 45 46Figure out where the navigation instructions actually lead. [1m[37mWhat is the Manhattan distance 47between that location and the ship's starting position?[0m 48 49