Commit Graph

64 Commits (6704766ebac1fb2bdafc2114fdf2de0a403883f6)

Author SHA1 Message Date
magical 6704766eba use dict for 'visit' var in day 16
not sure if this is an improvement? it's more or less the same
as the array version
2023-12-19 04:57:53 +00:00
magical ef2711b76f prelude: add ltranspose 2023-12-19 04:54:36 +00:00
magical 7baf6aa596 prelude: add lextract 2023-12-19 04:50:01 +00:00
magical 89dcdeb553 prelude: add an example for transform 2023-12-19 04:49:17 +00:00
magical 3faf36c645 ignore extra samples 2023-12-18 06:40:01 +00:00
magical 578f6e87ac day 18 part 2 2023-12-18 06:37:56 +00:00
magical bf4e88d66f day 18 part 1 2023-12-18 05:20:25 +00:00
magical fe76e83e98 day 17 fix cost calculation
i was accidentally using the previous coordinates to calculate the cost
for each node, which means the A* search was effectively calculating the
cost of the return trip instead of the forward path.
doesn't affect the path at all - the start and end nodes are fixed, so
it doesn't matter whether their costs are included or not - but it does
mean that the cost being returned at the end was off by ((value at end
point) - (value at start point)) compared to the expected value.
2023-12-17 06:42:34 +00:00
magical 14ef33326e day 17 solution
there's a small bug in the cost calculation which will be fixed in the
next commit
2023-12-17 06:26:31 +00:00
magical 539cf753d0 day 16 cleanup
switch to globals (passing array names around is ugly).
(maybe look into dicts sometime?)

also, properly detect width/height from the input
instead of hardcoding it
2023-12-17 06:24:26 +00:00
magical c592761d00 day 15 use dicts
tcl's dict type is exactly what we need for this problem:
an order-preserving de-duplicated list of key-value pairs.
2023-12-16 06:57:12 +00:00
magical 94bf752568 day 16 part 2 2023-12-16 06:02:16 +00:00
magical b14209ff39 day 16 part 1 2023-12-16 05:43:57 +00:00
magical f638ffbff7 day 15 solution 2023-12-15 06:11:06 +00:00
magical 5ad3c05219 day 14 part 2 2023-12-14 09:46:06 +00:00
magical cf548cb740 day 14 part 1 2023-12-14 09:45:13 +00:00
magical 632022d073 add more helpers
llen and slen to get the length of a list or string.
trim, replace and splitstr for common string operations.
2023-12-13 07:13:37 +00:00
magical b99ad03de5 day 13 part 2 2023-12-13 06:04:18 +00:00
magical 918d64f258 day 13 part 1 2023-12-13 05:44:49 +00:00
magical c55423d6f3 day 12 cleanup 2023-12-12 09:41:08 +00:00
magical 99405e2ad0 day 12 solution 2023-12-12 09:27:06 +00:00
magical e8a6d55fa8 day 11 part 2 2023-12-12 04:56:27 +00:00
magical b7062a7801 day 11 part 1 2023-12-11 05:31:14 +00:00
magical 55158903e6 day 10 much faster fill with numpy 2023-12-10 07:39:06 +00:00
magical 3b5b9f3839 day 10 more efficient fill
i also tried getting rid of the 'next' dict and just keeping track of a
boolean of whether we changed anything on each pass, but that made it
slower somehow. cache effects i guess?
2023-12-10 07:03:54 +00:00
magical 3ba6804013 day 10 cleanup, make fill slighly more efficient 2023-12-10 06:43:32 +00:00
magical c111075e16 day 10 part 2 2023-12-10 06:30:14 +00:00
magical a395a39fac day 10 part 1 2023-12-10 05:35:54 +00:00
magical 395ad666c8 fix lmul 2023-12-09 07:16:10 +00:00
magical 484c0744fb add a note 2023-12-09 07:15:58 +00:00
magical 99621f071a day 9 solution 2023-12-09 05:27:36 +00:00
magical 1c770538b7 day 8 part 2 solution 2023-12-08 06:55:04 +00:00
magical 792c9b5e23 day 8 part 2 slow solution 2023-12-08 05:43:15 +00:00
magical 5c257a3030 day 8 part 1 2023-12-08 05:19:09 +00:00
magical a3d768bdb5 the hand speaks 2023-12-08 03:35:54 +00:00
magical 16bf45bcbf day 5 tcl solution 2023-12-07 18:40:44 -08:00
magical dfa1fc0ed5 move {#} to prelude.tcl 2023-12-07 21:59:35 +00:00
magical 04f091e4a7 chmod +x 2023-12-07 07:39:20 +00:00
magical ba438b7b05 day 7 more cleanup
we don't need to know the card identities when determining hand-type,
just the counts
2023-12-07 07:37:07 +00:00
magical 8081b6f1fa day 7 cleanup
borrow an idea from elly's solution: we don't need separate copies of
each function in order to treat jokers differently, we can just replace
the Js with a different letter
2023-12-07 07:34:17 +00:00
magical bea122a661 trim 2023-12-07 07:08:20 +00:00
magical a0d4b47e16 day 7 part 2 2023-12-07 07:08:20 +00:00
magical d4485070f4 day 7 part 1 2023-12-07 07:08:20 +00:00
magical f58ed8eb97 day 4 tcl solution 2023-12-06 23:04:25 -08:00
magical 0fb7b77afe day 2 tcl solution 2023-12-06 23:04:25 -08:00
magical f1e2dc0d24 slightly more idiomatic tcl?
lmul is a more idiomatic name than product.
using join+eval is probably slower than foreach but the lists are small
so i don't care.
2023-12-06 07:06:20 +00:00
magical 905dee030f day 6 tcl solution 2023-12-06 06:52:26 +00:00
magical ed146f7fe1 day 6 fancy solution + cleanup 2023-12-06 06:20:12 +00:00
magical b480088127 day 6 solution 2023-12-06 05:11:23 +00:00
magical cfdab32f3f day 1 part 2 tcl solution 2023-12-06 03:40:44 +00:00