28 Commits

Author SHA1 Message Date
Aryadev Chavali
51a6d1e923 Solve puzzle 11 2022. 2024-10-30 22:34:10 +00:00
Aryadev Chavali
65b65a2a3e Introduce tests for split-by-first and split-by-completely
Allows one to split by string delimiter, or anything else.
2024-10-30 22:33:31 +00:00
Aryadev Chavali
de4c5bbd53 Fixup some stuff 2024-10-30 22:33:27 +00:00
Aryadev Chavali
d357964e2f FINALLY figured out puzzle 10 2022
Part 2 was a real struggle to get right, though part 1 was way easier.
2024-10-30 22:33:27 +00:00
Aryadev Chavali
07a5f754da Update lib.lisp to be more imperative and include a threading macro
Instead of (f (g (h (j (k x))))) we can write
(-> (k x)
    (j it)
    (h it)
    (g it)
    (f it))

which is works really well for particularly large and complicated
expressions.
2024-10-30 22:33:27 +00:00
Aryadev Chavali
cd94c350e6 Use every instead of all 2024-10-29 20:00:39 +00:00
Aryadev Chavali
e5c805a17a Finished round 2 of puzzle 9
Annoying bug that took ages to fix: for multi-execute, there may be
times where movements go in complete diagonals.  In this case, we need
to move in the unit vector diagonal direction.  So I modified
update-tail for this case.  Never happens in round 1 lol.
2023-10-21 04:25:23 +01:00
Aryadev Chavali
b99cda7087 Finished round 1 of puzzle 9
Pretty interesting, functional idioms kinda fail here as there are no
nice functions I can think of for the single-knot-execute-line
`dotimes` section.  I could use tail recursion with an optimisation
but this is pretty explicit.  You can compare execute-lines to
execute-line to see which type of iteration fits you.
2023-10-18 17:03:36 +01:00
Aryadev Chavali
67fdc3157f Finished round 2 of puzzle-8 2023-10-17 21:53:46 +01:00
Aryadev Chavali
3aa1e31d5b Finished round 1 of puzzle-8 2023-10-17 20:42:13 +01:00
Aryadev Chavali
f32f774eae Added all and remove-nth
Does what they say, all is the logical inverse to some.
2023-10-17 20:41:54 +01:00
Aryadev Chavali
db2ef41d19 Started puzzle-8 2023-10-17 20:07:34 +01:00
Aryadev Chavali
ceaaad427c split-by->split-by-first, split-completely->split-by-completely 2023-10-17 20:07:19 +01:00
Aryadev Chavali
f11415c365 FINALLY figured out the solution to puzzle 7
Easy problem once I figured out the trick to constructing an
inherently stateful structure with backwards pointer references (at
least the first way I would've made it) into a functional alist
solution.  Very cool.
2023-10-17 19:58:34 +01:00
Aryadev Chavali
31878dd6e8 Made a rough sketch comment of puzzle-7 structure 2023-10-17 15:06:53 +01:00
Aryadev Chavali
9c1e581524 Current implementation of puzzle-7
Not complete, dunno what to do for parsing and handling CD commands.
2023-10-17 14:42:01 +01:00
Aryadev Chavali
43b1575154 Better comment on puzzle-6.lisp 2023-10-17 14:35:41 +01:00
Aryadev Chavali
4352928861 Update 2022/README with puzzle solution descriptions 2023-10-17 14:35:23 +01:00
Aryadev Chavali
7f8c330801 Use lib.lisp in puzzle-6 2023-10-17 14:25:15 +01:00
Aryadev Chavali
7daceb30d1 Remove python version of puzzle 1
Lisp version is satisfactory.
2023-10-17 14:24:55 +01:00
Aryadev Chavali
480c0f61b4 Made a python version of puzzle 1
I'm going to use a different language per puzzle now.
2023-10-17 14:14:38 +01:00
Aryadev Chavali
d3ed2f503e Version control lib.lisp 2023-10-17 14:14:38 +01:00
Aryadev Chavali
14f428b3a3 (*)~changed to relative file naming 2023-10-17 14:14:38 +01:00
Aryadev Chavali
2013cb4f5f (2022>6)+solution for problem 6 2023-10-17 14:14:38 +01:00
Aryadev Chavali
1041984da0 (2022>README,1,5)+literate code for problem 1 rewrite,~minor changes to 5
Making README.org a literate document for my code to better describe
my process.
2023-10-17 14:14:38 +01:00
Aryadev Chavali
3d8c645541 ~test 2023-07-09 13:27:12 +01:00
Aryadev Chavali
893abb4f26 (2022>puzzle-5)+solution for puzzle-5
Wow, quite involved and definitely cleanable but goddamn so much fun.
2023-06-26 10:31:41 +01:00
Aryadev Chavali
c0964cbb42 (*->2022)~made it clear what advent of code I'm doing 2023-06-26 08:36:53 +01:00