o
odinpkg.dev
packages / library / AoC_2023

AoC_2023

e552a42library

No description provided.

No license · updated 3 years ago

Advent of Code 2023 done in the Odin programming language

https://adventofcode.com/

https://odin-lang.org/

Advent of code is an annual Christmas-themed coding challenge that poses problems to be solved with code. An original two-part challenge is released each day starting December 1st.

I am still learning the Odin programming language, I am by no means an expert.

I am not doing this to be competitive so I will likely fall behind as I work full time during the week. I will do what I can to catch up and go as far as I am able

Status:
Day 1 parts A and B complete. Learned basic file reading in Odin
Day 2 complete and correct. More parsing, made some helper procedures for easier to read code
Day 3 complete and correct. Many helper procedures made and working together.
Day 4 complete and correct. Worked all week so I will be catching up on the challenges. Added notes as the problems are becoming more complicated (as expected)
Day 5 part 1 complete, got some practice using odin's dynamic arrays
Day 6 Both parts complete, easy compared to day 5
Day 7 I spent a lot of time on this one implementing multiple sorts in order to score the cards correctly. After part A was correct, part B was rather simple. The timing took a real hit due to the multiple sorting, roughly 40 milliseconds total run time for each part. Most of the previous challenge solutions are in the sub-millisecond range on my machine. The sorting algorithm is a basic bubble sort though and could be improved upon.
Day 8 Could only complete part 1, for part 2 I am able to make the test input work, but not the actual input, it just gets stuck in an endless loop. I spent hours on this before giving up
Day 15 I skipped multiple days to catch up to the current challenges. Again I spent hours on part 2, but it turns out I had the solution early on, I just didn't realize that Odin doesn't do depe copys of strings by default, so when I was comparing strings, I was really comparing the pointers to the same allocated space and getting a positive every time, ruining the outcome of the challenge. Once I realized this, it was a simple copy and I got the correct answer on my first try.

With that I think I've gotten as far as I can go with advent of code 2023, It's been some interesting challenges and I have learned a few things about working with this programming language