Advent of Code 2023 day 16
12/16/2023, 5:00 AMTomasz Linkowski
12/16/2023, 5:50 AM-
and |
the other way round.
For part 2, my model made it easy to iterate all the starting points and doing maxOf
on the results 😌Michael de Kaste
12/16/2023, 5:56 AMephemient
12/16/2023, 6:03 AMephemient
12/16/2023, 6:11 AMbj0
12/16/2023, 6:16 AMbj0
12/16/2023, 6:17 AMPaul Woitaschek
12/16/2023, 6:27 AMJakub Gwóźdź
12/16/2023, 6:33 AM-
to +
when copying case East
into West
, (this little maneuver costed me 51 years)Norbert Kiesel
12/16/2023, 6:33 AMJakub Gwóźdź
12/16/2023, 6:35 AMMarcin Wisniowski
12/16/2023, 6:59 AMPaul Woitaschek
12/16/2023, 7:04 AMJakub Gwóźdź
12/16/2023, 7:04 AMMarcin Wisniowski
12/16/2023, 7:06 AMwhen
statements inside, but this way they only take one line each. 😄Paul Woitaschek
12/16/2023, 7:10 AMJakub Gwóźdź
12/16/2023, 7:13 AMMarcin Wisniowski
12/16/2023, 7:16 AMrunBlocking
Neil Banman
12/16/2023, 7:27 AMNeil Banman
12/16/2023, 7:33 AMNeil Banman
12/16/2023, 7:37 AMephemient
12/16/2023, 7:39 AMrunBlocking
doesn't create a multi-threaded dispatcher, you should use withContext(Dispatchers.Default)
or similar if you want to actually fork workNeil Banman
12/16/2023, 7:54 AMPaul Woitaschek
12/16/2023, 7:55 AMNeil Banman
12/16/2023, 7:58 AMPaul Woitaschek
12/16/2023, 8:01 AMNeil Banman
12/16/2023, 8:02 AMMarcin Wisniowski
12/16/2023, 8:11 AMPaul Woitaschek
12/16/2023, 8:12 AMJakub Gwóźdź
12/16/2023, 8:13 AMsuspend
on main()
also can set up something.Grzegorz Aniol
12/16/2023, 8:17 AMMarcin Wisniowski
12/16/2023, 8:24 AMIf the context does not have any dispatcher nor any other ContinuationInterceptor, then Dispatchers.Default is used.So if you use
async
in a runBlocking
that doesn't set a Dispatcher, you will use Dispatcher.Default
and get multi-threading as expected.Paul Woitaschek
12/16/2023, 8:45 AMJakub Gwóźdź
12/16/2023, 8:47 AMJakub Gwóźdź
12/16/2023, 8:47 AMPaul Woitaschek
12/16/2023, 8:48 AMAnirudh
12/16/2023, 8:55 AMNorbert Kiesel
12/16/2023, 8:56 AMAnirudh
12/16/2023, 8:57 AMJakub Gwóźdź
12/16/2023, 9:12 AMandriyo
12/16/2023, 9:18 AMAnirudh
12/16/2023, 9:22 AMbut now part 1 doesn't work and Ctrl+Z history isn't going back far enough 🤦solved! guess which dumb**s updated
expectedOutput
to 51 for part 2 but in the part 1 test where it was supposed to be 46.
that's 30 minutes I'm never getting backMarcin Wisniowski
12/16/2023, 9:24 AMI always commit (but not push) after solving part 1, so that I have a reference point when refactoringI seem to be in the minority but I do part 1 and part 2 separately, in different files, with nothing shared. So Part 1 is always there when working on Part 2.
ephemient
12/16/2023, 9:31 AMAnirudh
12/16/2023, 10:18 AMPair(Point, incomingDirection)
◦ so each mirror/splitter would actually be 4 nodes, one for each incoming direction
2. each node would have exactly 4 connected nodes - which would be other mirrors/splitters/pass-throughs or the walls in the Up, Down, Left, Right directions
3. the weight
on each node would be the straight-line distance (xrange or yrange) to the next node/wall
4. calculating weightToWall
(starting null or 0) would then be a cumulative backfill and can be cached/saved/attribute, since it's unique for that Point from an incoming Direction. ie unique for each Node
5. additionally, the walls can also be made Nodes, but with only 1 connected node - either the opposite wall or any mirror/splitter/pass-through that comes before the opposite wallelizarov
12/16/2023, 11:05 AMelizarov
12/16/2023, 11:08 AMCharles Flynn
12/16/2023, 11:41 AMCharles Flynn
12/16/2023, 11:42 AMCharles Flynn
12/16/2023, 11:53 AMEl Anthony
12/16/2023, 12:01 PMJakub Gwóźdź
12/16/2023, 12:03 PMEl Anthony
12/16/2023, 12:11 PMEl Anthony
12/16/2023, 12:52 PMtodd.ginsberg
12/16/2023, 4:22 PMBrian Dupuis
12/16/2023, 6:01 PMOzioma Ogbe
12/17/2023, 3:11 AM