In December 2024, I joined Jeremy Howard's new course, Solve It With Code, by fast.ai. This unique program introduces a fresh approach to coding that combines iterative problem-solving with AI. It emphasizes building foundational skills without requiring a background in data structures or computer science. The course focuses on using Python (with minimal external libraries) and teaches an engineering technique that integrates AI as a collaborative tool (source).
This repository contains my solutions to the Advent of Code 2023 challenges, crafted using the engineering process taught in the course. Beyond the solutions, you can see how each solution was developed in dialog with the AI. The solutions are organized in the solutions folder, the dialogues in the dialogues folder, and the input data for each challenge is stored in the data folder.
Note: The input data for each challenge differs by user. If you are using this project as a template for your own solutions, you will need to log in to the Advent of Code website to download your personal puzzle input data and use it to replace the existing files in the ./data/ folder. To update the table of challenges, read these instructions below.
Day | Challenge | Solution Code | Solution Dialog | Time Complexity | Space Complexity | Challenge Link |
---|---|---|---|---|---|---|
1 | Trebuchet?! | link | link | O(n * m) | O(1) | adventofcode.com |
2 | Cube Conundrum | Unsolved | - | - | - | adventofcode.com |
3 | Gear Ratios | Unsolved | - | - | - | adventofcode.com |
4 | Scratchcards | Unsolved | - | - | - | adventofcode.com |
5 | If You Give A Seed A Fertilizer | Unsolved | - | - | - | adventofcode.com |
6 | Wait For It | Unsolved | - | - | - | adventofcode.com |
7 | Camel Cards | Unsolved | - | - | - | adventofcode.com |
8 | Haunted Wasteland | Unsolved | - | - | - | adventofcode.com |
9 | Mirage Maintenance | Unsolved | - | - | - | adventofcode.com |
10 | Pipe Maze | Unsolved | - | - | - | adventofcode.com |
11 | Cosmic Expansion | Unsolved | - | - | - | adventofcode.com |
12 | Hot Springs | Unsolved | - | - | - | adventofcode.com |
13 | Point of Incidence | Unsolved | - | - | - | adventofcode.com |
14 | Parabolic Reflector Dish | Unsolved | - | - | - | adventofcode.com |
15 | Lens Library | Unsolved | - | - | - | adventofcode.com |
16 | The Floor Will Be Lava | Unsolved | - | - | - | adventofcode.com |
17 | Clumsy Crucible | Unsolved | - | - | - | adventofcode.com |
18 | Lavaduct Lagoon | Unsolved | - | - | - | adventofcode.com |
19 | Aplenty | Unsolved | - | - | - | adventofcode.com |
20 | Pulse Propagation | Unsolved | - | - | - | adventofcode.com |
21 | Step Counter | Unsolved | - | - | - | adventofcode.com |
22 | Sand Slabs | Unsolved | - | - | - | adventofcode.com |
23 | A Long Walk | Unsolved | - | - | - | adventofcode.com |
24 | Never Tell Me The Odds | Unsolved | - | - | - | adventofcode.com |
25 | Snowverload | Unsolved | - | - | - | adventofcode.com |
.
├── Dockerfile.readme <- Defines the Docker environment for generating this README.md file
├── Dockerfile.data <- Defines the Docker environment for downloading the advent of code data
├── README.md <- You are reading this right now
├── README.template <- Template for dynamically generating the README file
├── challenges.json <- Metadata about Advent of Code 2023 challenges
├── download_data.py <- Script to download the Advent of Code data
├── download_data_using_docker.sh <- Runs download_data.py inside a Docker container
├── generate_readme.py <- Script to generate the README dynamically
├── generate_readme_using_docker.sh <- Runs generate_readme.py inside a Docker container
├── requirements.txt <- Lists the Python dependencies for the project
├── data <- Contains input and sample data for challenges
│ ├── dayXX_input.txt <- Main input data for each challenge, downloaded using the downloader
│ ├── dayXX_sample.txt <- Sample input manually extracted from the challenge description for testing
│ └── dayXX_test.txt <- Additional test data you may want to add yourself
├── dialogues <- Contains the solution dialog as Juptyer notebooks
│ ├── XX_*.ipynb <- Juptyer notebooks for each challenge day XX=01,...,25
└── solutions <- Contains Python solution scripts for each challenge
└── XX_*.py <- Python scripts containing the solutions for each challenge day XX=01,...,25
To set up the project on your local machine, follow these steps:
- Clone this repository.
- Ensure that Docker is installed and running on your system.
Advent of code has different input data for each user. This means you need to download your personal input data to solve the challenges. The following describes how you can download the data for all 26 days almost automatically. You need to do this only once.
- Create a
.env
file in the project root and add the following line to it:
AOC_SESSION=<insert_your_session_key_here>
This file holds your session key, which is required to download the data.
The next section describes how you can get the session key to insert into the .env
file.
- Log in to the Advent of Code website.
- Open your browser's developer tools (right-click anywhere on the page and select "Inspect" or press
F12
). - Navigate to the "Application" tab (in Chrome) or "Storage" tab (in Firefox).
- Locate the "Cookies" section and click on
adventofcode.com
. - Find the cookie named
session
and copy its value. - Paste this value into your
.env
file as theAOC_SESSION
variable.
Run the following command to make the script executable:
chmod +x ./download_data_using_docker.sh
Run the following command:
./download_data_using_docker.sh
- This will build the Docker image and run the
download_data.py
script inside the container. - The script will download the Advent of Code data for the specified day and year.
Once the container execution is finished, the downloaded data files day*_input.txt
will be available in ./data/
folder.
Generating the README.md
file updates the cells of the challenges table based on the metadata from the challenges.json
file the content (!) of the solution files automatically.
Note: The time and space complexity are extracted from the solution files by looking for lines that start with Time complexity:
and Space complexity:
respectively. Please ensure that these lines are present in your solution files as well. Here are some valid examples:
"""
...
Time complexity: O(...)
Space complexity: O(...)
...
"""
or
...
# Time complexity: O(...)
...
# Space complexity: O(...)
...
To generate the README.md
file, follow these steps:
Run the following command to make the script executable:
chmod +x ./generate_readme_using_docker.sh
./generate_readme_using_docker.sh
- This will build the Docker image each time it is run to avoid file caching issues.
- It will then run the Docker container to execute the
generate_readme.py
script, which generates theREADME.md
file and overwrites the exitingREADME.md
file in your local directory.
Once the container execution is finished, you should see the updated README.md
file in the same directory where you ran the script.