64 Commits

Author SHA1 Message Date
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
ef2711b76f prelude: add ltranspose 2023-12-19 04:54:36 +00:00
7baf6aa596 prelude: add lextract 2023-12-19 04:50:01 +00:00
89dcdeb553 prelude: add an example for transform 2023-12-19 04:49:17 +00:00
3faf36c645 ignore extra samples 2023-12-18 06:40:01 +00:00
578f6e87ac day 18 part 2 2023-12-18 06:37:56 +00:00
bf4e88d66f day 18 part 1 2023-12-18 05:20:25 +00:00
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
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
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
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
94bf752568 day 16 part 2 2023-12-16 06:02:16 +00:00
b14209ff39 day 16 part 1 2023-12-16 05:43:57 +00:00
f638ffbff7 day 15 solution 2023-12-15 06:11:06 +00:00
5ad3c05219 day 14 part 2 2023-12-14 09:46:06 +00:00
cf548cb740 day 14 part 1 2023-12-14 09:45:13 +00:00
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
b99ad03de5 day 13 part 2 2023-12-13 06:04:18 +00:00
918d64f258 day 13 part 1 2023-12-13 05:44:49 +00:00
c55423d6f3 day 12 cleanup 2023-12-12 09:41:08 +00:00
99405e2ad0 day 12 solution 2023-12-12 09:27:06 +00:00
e8a6d55fa8 day 11 part 2 2023-12-12 04:56:27 +00:00
b7062a7801 day 11 part 1 2023-12-11 05:31:14 +00:00
55158903e6 day 10 much faster fill with numpy 2023-12-10 07:39:06 +00:00
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
3ba6804013 day 10 cleanup, make fill slighly more efficient 2023-12-10 06:43:32 +00:00
c111075e16 day 10 part 2 2023-12-10 06:30:14 +00:00
a395a39fac day 10 part 1 2023-12-10 05:35:54 +00:00
395ad666c8 fix lmul 2023-12-09 07:16:10 +00:00
484c0744fb add a note 2023-12-09 07:15:58 +00:00
99621f071a day 9 solution 2023-12-09 05:27:36 +00:00
1c770538b7 day 8 part 2 solution 2023-12-08 06:55:04 +00:00
792c9b5e23 day 8 part 2 slow solution 2023-12-08 05:43:15 +00:00
5c257a3030 day 8 part 1 2023-12-08 05:19:09 +00:00
a3d768bdb5 the hand speaks 2023-12-08 03:35:54 +00:00
16bf45bcbf day 5 tcl solution 2023-12-07 18:40:44 -08:00
dfa1fc0ed5 move {#} to prelude.tcl 2023-12-07 21:59:35 +00:00
04f091e4a7 chmod +x 2023-12-07 07:39:20 +00:00
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
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
bea122a661 trim 2023-12-07 07:08:20 +00:00
a0d4b47e16 day 7 part 2 2023-12-07 07:08:20 +00:00
d4485070f4 day 7 part 1 2023-12-07 07:08:20 +00:00
f58ed8eb97 day 4 tcl solution 2023-12-06 23:04:25 -08:00
0fb7b77afe day 2 tcl solution 2023-12-06 23:04:25 -08:00
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
905dee030f day 6 tcl solution 2023-12-06 06:52:26 +00:00
ed146f7fe1 day 6 fancy solution + cleanup 2023-12-06 06:20:12 +00:00
b480088127 day 6 solution 2023-12-06 05:11:23 +00:00
cfdab32f3f day 1 part 2 tcl solution 2023-12-06 03:40:44 +00:00