Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Advent of Code 2019
#9
Day #3

I was in real hurry with this one. So I decided to approach this 'systematically' in top-down style. I wanted to do some generator chaining but in order to get ready before my time was up I didn't follow this initial thought. Also - I did vectors decades ago, so I let shapely and numpy to do heavy lifting. This is brute-force and probably there is some math which allows to reach same result with less work.

Puzzel # 1:
'find intersection point with smallest Manhattan distance from start (0,0)'
For that:
  • read data from webpage
  • calculate relative moves
  • calculate path using relative moves
  • convert into shapely LineString
  • find all intersections
  • find smallest Manhattan distance from intersections
  • output smallest Manhattan distance


Puzzle # 2:
Intersection points were already found. So:
'Find smallest distance to intersection point' (function 'shortest_distance' in code above)
I'm not 'in'-sane. Indeed, I am so far 'out' of sane that you appear a tiny blip on the distant coast of sanity. Bucky Katt, Get Fuzzy

Da Bishop: There's a dead bishop on the landing. I don't know who keeps bringing them in here. ....but society is to blame.
Reply


Messages In This Thread
Advent of Code 2019 - by ThomasL - Nov-30-2019, 10:24 AM
RE: Advent of Code 2019 - by Gribouillis - Dec-01-2019, 04:08 AM
RE: Advent of Code 2019 - by ThomasL - Dec-01-2019, 03:30 PM
RE: Advent of Code 2019 - by perfringo - Dec-01-2019, 08:39 AM
RE: Advent of Code 2019 - by perfringo - Dec-02-2019, 07:44 AM
RE: Advent of Code 2019 - by ThomasL - Dec-02-2019, 12:51 PM
RE: Advent of Code 2019 - by snippsat - Dec-02-2019, 01:17 PM
RE: Advent of Code 2019 - by perfringo - Dec-02-2019, 02:33 PM
RE: Advent of Code 2019 - by perfringo - Dec-04-2019, 07:56 AM
RE: Advent of Code 2019 - by ndc85430 - Dec-15-2019, 10:54 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Advent of code 2023 snippsat 2 786 Dec-08-2023, 06:52 PM
Last Post: snippsat
  PyCon 2019 snippsat 0 1,908 May-03-2019, 06:52 PM
Last Post: snippsat
  The most important skills for Python devs in 2019 adosii 6 3,617 Apr-27-2019, 12:17 AM
Last Post: Skaperen
  Stackoverflow Developer Survey Results - 2019 buran 1 2,332 Apr-09-2019, 05:23 PM
Last Post: Gribouillis
  PyConWeb 2019 bugy 0 1,926 Feb-06-2019, 08:31 AM
Last Post: bugy
  Advent of Code 2018 snippsat 0 2,592 Dec-01-2018, 11:05 PM
Last Post: snippsat
  Advent of Code 2017 stranac 5 4,783 Dec-05-2017, 08:50 AM
Last Post: buran
  Advent of Code 2016 snippsat 4 6,523 Dec-06-2016, 10:35 PM
Last Post: nilamo

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020