# Day 1: Advent of Code, Elixir, and Aider

It’s official – I’m diving into Advent of Code 2024 with [**Elixir**](https://elixir-lang.org/), one of my all-time favorite programming languages. Elixir has this elegant simplicity and scalability that I adore. While it’s not as mainstream as JavaScript or Python, its growing popularity makes it perfect for this kind of challenge. Plus, it’s a great excuse to brush up on my skills. You can follow along or grab the code here: [GitHub Repository](https://github.com/rjNemo/ai_advent_code_2024). Feel free to submit pull requests for your favorite language!

For this journey, I’m using [**Aider**](https://aider.chat/) as my AI assistant, powered by [**Claude Sonnet 20241022**](https://www.anthropic.com/news/3-5-models-and-computer-use) from Anthropic. The setup includes the [aider.nvim plugin](https://github.com/joshuavial/aider.nvim) integrated with [Neovim](https://neovim.io/). So far, Aider + Claude has been surprisingly reliable – it feels like working with a junior dev with a large memory who’s super confident but occasionally clueless. Dangerous? Yes. Manageable? Absolutely, with strict testing practices.

In the rest of the article I will mention Aider but keep in mind that the results vary greatly based on the model used.

# **Part 1: Getting Started with the First Challenge**

First up, let’s fetch the Day 1 challenge. Aider makes this easy with its `/web` command, which uses Playwright to scrape web pages.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1733053700581/925808c8-a9c9-4264-94d9-f20614a47205.png align="center")

One cool feature of Aider is its ability to commit changes directly to Git and run CLI commands. It’s a little like having an overachieving intern who documents everything meticulously.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1733053905561/52f27a2e-45de-429d-b9ef-fe4828be71dc.png align="center")

**Here’s my process:**

1. **Write Tests First**
    

I began by asking Aider to create tests based on the examples provided in the challenge. It generated:

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1733053538039/9c3ec2f7-26d3-40b2-97a0-575320c4179a.png align="center")

2. **Generate Production Code**
    

Next, I asked Aider to write the production code to pass those tests. It required explicitly adding files for context, which I found useful for keeping the AI focused.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1733054048235/d1f5f547-3c20-4826-9c54-41ae825ce6c7.png align="center")

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1733054193725/bef11ffc-07ec-4c49-8e00-56fd72457297.png align="center")

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1733053580854/e221f15e-91ef-4a62-855b-beef388b0ebe.png align="center")

3\. **Run the Tests**

Running the tests confirmed that the example passed. A solid start.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1733054245821/e2642ff9-d4f2-43c8-9a2c-21bdb1bbc416.png align="center")

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1733054252670/852e4cb0-9864-434f-a9fe-974b6338b5db.png align="center")

## **Solving the Challenge**

Advent of Code provides unique inputs for each participant. I asked Aider to fetch my input and store it in a file.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1733054550695/f3d8a956-b754-4c8c-ac82-c6ca14e12587.png align="center")

The result?

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1733053551060/8aff1f59-2fc9-4686-97cb-e1aaffff9379.png align="center")

Great success!

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1733054306562/d8a5ee9e-fc5f-40cd-9be3-d34b83ab9651.png align="center")

## My thoughts so far

I’m impressed by how effective Aider is with minimal and sometimes vague prompts. While I didn’t love every stylistic choice it made, the experience reminded me of reviewing code from junior developers at work: functional, decent style, but room for improvement. It’s oddly nostalgic.

# **Part 2: The Harder Variant**

Advent of Code challenges always include a second part—a more difficult twist on the original problem. Here’s how it went:

1. **Fetch the Challenge**
    

For the first time, Aider struggled to retrieve the content automatically. Perhaps the site’s structure was to blame. No worries; I added it manually.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1733054773570/23a4ea41-29ad-4c05-a20c-1aa24fa62634.png align="center")

2. **Repeat the Process**
    

Just like Part 1, I wrote tests based on the example and asked Aider to implement the solution. It delivered:

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1733054885324/2d497d26-679b-4218-9420-4c3a3a6826f5.png align="center")

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1733053558682/48cb4aeb-1b02-461c-b11c-bc7ce43925c0.png align="center")

3. **Great Success Again!**
    

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1733054928660/548d128a-662b-4296-9bdc-4f3b658718b8.png align="center")

# Refactoring

To wrap things up, I spent some time refactoring the code. While Aider’s solutions worked, there’s always room to clean up and improve readability. Refactoring is a satisfying part of the process, turning a rough draft into something polished.

# Conclusion

Day 1 is in the books, and it’s been a blast so far. Using Aider feels like a hybrid experience between mentoring and pair programming.

It has been an eye-opener. Collaborating with Aider has shown me just how far AI tools have come – not just as coding assistants but as reliable collaborators for problem-solving. For **senior engineers** and **engineering managers**, I believe this kind of tool is invaluable for keeping in touch with the code by building prototypes. It allows you to focus on higher levels of abstraction, like architecture and overall design, while letting the AI handle implementation details.

That said, this experience has reinforced an important lesson: **testing discipline is crucial** when working with AI. Reliable software isn’t just about getting things to work – it’s about ensuring they keep working as expected. With proper testing practices, tools like Aider can become powerful allies in any developer’s toolkit.

Stay tuned for Day 2. Here’s to more challenges, more learning, and a productive Advent of Code 2024!
