This repository contains the code for the practice challenges for the Advent of Code. I used C#8.0 to through all of them and Visual Studio 2022 as the IDE.
The solution is organized by projects. There is library one project called Common
which contains an Utils
class to retrieve the input data directly from the Advent od Code website. It is required to have an appsettings.json
file with the following arguments:
{
"Year": 2021,
"SessionCookie": SESSION_COOKIE_VALUE
}
To get the SESSION_COOKIE_VALUE
:
- Login on Advent of Code with your account. Open your browser’s developer console. This is usually done by right-clicking on the page and selecting “Inspect” or "Inspect Element".
- Navigate to the Network tab in the developer console.
- Refresh the page or navigate to any input page, such as https://adventofcode.com/2021/day/1/input.
- In the list of network requests, click on the request for the page you just loaded. This will open a panel with details about the request.
- Look for the “Cookie” header in the request headers section. The value of this header is your session cookie.
The rest of the projects are named with the format Day00
, according to the challenge day. They are console projects that may be launched directly from the IDE or using:
dotnet run --project NAME_OF_PROJECT
Note
The .NET CLI must be installed to run the previous command.