Commit Graph

83 Commits

Author SHA1 Message Date
8ec58edd08 solve day 18!
it was kinda ez
2024-02-13 23:03:04 -08:00
1904239ca7 reorganize day 17 code a bit 2024-01-11 10:48:11 -08:00
46d49dc3fe add pretty printed tower test in day 17 2024-01-11 10:19:39 -08:00
950f2860df fix day 12 performance regerssion
caused by a change to Grid.at_e that would eagerly format an exception
string even if the function never throws an exception.
2024-01-08 12:48:55 -08:00
d203c9a520 finish day 17 part 2 2024-01-08 12:36:14 -08:00
8b54ae782c finish day 17 part 1 2024-01-05 11:33:26 -08:00
9f1499a1d3 implement day 17 rock falling logic 2024-01-04 00:38:09 -08:00
490696c63d make Grid.draw more flexible
- printer callback includes Vec2.t in the arguments now
- added optional rev_x and rev_y params
2024-01-03 09:18:57 -08:00
a7c039197b fix .ocamlinit ?? 2024-01-03 09:18:27 -08:00
ryan
94f4badcc4 30x speedup on 16.2 from using bitmasks as a set!! 2023-12-04 23:28:54 -08:00
rmanseau
4e57ad4072
clean up 15.1 implementation a bit 2023-11-27 13:45:32 -08:00
ryan
f2f3e497d6 get rid of old day 16 solution 2023-11-23 21:35:32 -08:00
ryan
2a515a5323 day 16.1 down to 1.5 seconds !! 2023-11-23 12:22:17 -08:00
ryan
5c0d7867a4 speed up 16.2 by 10x but its still 10 seconds >:( 2023-11-23 11:17:41 -08:00
ryan
1df5532c24 finally solved day 16 part 2 (in 100 seconds :P) 2023-11-22 22:58:22 -08:00
ryan
8db68c9baf use djikstra to get min dist between all valves
now i should be able to rewrite traverse in a way that doesn't suck
2023-11-22 18:27:42 -08:00
ryan
360be1a368 modify djikstra to work without a goal
if you give None as a goal, then it traverses the entire grid and finds
the shortest path to every node. the distances can then be queried via the
get_info that is passed in as an argument
2023-11-22 16:10:47 -08:00
ryan
ae2acb87fa refactor generalized djikstra out of day 12 2023-11-22 16:10:47 -08:00
ryan
c7eae53378 doesnt work for 16.2 :( 2023-11-21 23:22:43 -08:00
ryan
b9a36a476a brute force day 16.1 with incorrect algorithm lol
it gets the right answer for the input but not for the example input
2023-11-21 18:17:35 -08:00
ryan
8270ee7aa8 never touching day 15 ever again 2023-11-21 16:50:51 -08:00
ryan
894e83fe12 fix day 15 for example inputs
part 1 didn't work for the example input :(
2023-11-21 16:48:03 -08:00
ryan
11546bff5f fix ocamlformat
apparently `version = x` simply refuses to format if you dont have the
specified version. doesn't seem very useful for a repo like this.
2023-11-21 16:47:17 -08:00
ryan
d1e69ba66e cosmetic refactoring for day 15 2023-11-20 18:57:00 -08:00
ryan
2887274ad9 update the comment in day 15.1 2023-11-20 18:34:44 -08:00
ryan
6758130700 speed up day 15.1 with intersections
also update the vec module to use Iter in some places
2023-11-20 18:26:55 -08:00
ryan
ff4bb0ae89 simplify day 15 parsing with regex 2023-11-20 14:26:01 -08:00
ryan
b69f867423 update opam file 2023-11-20 14:25:38 -08:00
ryan
a652ec69da add memo wrapper for recursive functions 2023-11-20 14:11:04 -08:00
rmanseau
421616a282
add dev env packages to depends 2023-11-20 13:36:40 -08:00
rmanseau
f775ed645b
fix opam file and add install steps to README 2023-11-20 12:24:23 -08:00
ryan
705c9e9a7c faster 15.2 solution with line intersections :/ 2023-11-10 18:24:41 -08:00
ryan
8d97e7601c very slow solution to day 15 part 2 :)
could be sped up by doing math to find intesections points of the
borders but that sounds boring
2023-11-09 14:23:41 -08:00
ryan
b89e9c05ef refac day 14 to use new Vec2.bounds function 2023-11-08 10:37:44 -08:00
ryan
b90478cd03 solve day 15 part 1 ! 2023-11-08 10:37:31 -08:00
ryan
383c6c0fca add Vec2.iter_region 2023-11-08 10:36:33 -08:00
ryan
19a763b73f manually implement show & pp for Vec2
so that it prints as if it were a tuple
2023-11-08 09:14:22 -08:00
ryan
dcb1338aa3 parse day 15 2023-11-08 09:14:00 -08:00
ryan
724576d120 refactor day 14 a bit 2023-11-01 14:40:16 -07:00
ryan
ceaebf895d solve day 14! 2023-11-01 14:14:46 -07:00
ryan
ceb0f04a78 implement sand dropping logic & pretty visuals 2023-11-01 12:10:15 -07:00
ryan
c5c9b584c0 update Grid.%() operator to return option 2023-11-01 12:09:53 -07:00
ryan
80f29ae00e swap Vec2 up/down
going down on the grid increases the int for y
2023-11-01 12:08:43 -07:00
ryan
2418d2ff0d normalize points in input
this way i can print the full input in as small a space as possible!
2023-10-31 18:06:12 -07:00
ryan
1ca2a95e1d make Grid.set_e throw out of bounds errors 2023-10-31 18:05:10 -07:00
ryan
61e3520ede parse day 14 grid
haven't implemented the falling sand yet, but theres a cool expect test
that draws the grid
2023-10-31 17:04:20 -07:00
ryan
98f47654f8 change Vec2 implementation to a record type 2023-10-31 15:57:13 -07:00
ryan
88acb381f1 move Grid into its own file 2023-10-31 15:57:11 -07:00
ryan
1d60878428 add init_grid func 2023-10-31 14:43:12 -07:00
ryan
63bad67c1b create angstrom wrapper in Utils for int parser
and other common parsers for the future
2023-10-31 14:40:22 -07:00