Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/coko7/aoc-2023
My code for the Advent of Code 2023 edition
https://github.com/coko7/aoc-2023
advent-of-code aoc aoc-2023 aoc2023 csharp
Last synced: 3 days ago
JSON representation
My code for the Advent of Code 2023 edition
- Host: GitHub
- URL: https://github.com/coko7/aoc-2023
- Owner: Coko7
- License: mit
- Created: 2023-12-01T14:16:17.000Z (12 months ago)
- Default Branch: main
- Last Pushed: 2023-12-19T08:34:09.000Z (11 months ago)
- Last Synced: 2023-12-19T11:39:44.982Z (11 months ago)
- Topics: advent-of-code, aoc, aoc-2023, aoc2023, csharp
- Language: C#
- Homepage:
- Size: 81.1 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# aoc-2023
My code for the [Advent of Code - 2023 edition](https://adventofcode.com/2023)
## 👋 Introduction
When I first began doing [AOC](https://adventofcode.com) challenges in 2022, I had no setup. Each day, I would create all of the files manually before starting to write code.
It worked but it made me lose some time here and there. Usually, I would create the file before the daily challenge came out but sometimes I woke up late and lost a bit of time doing some late file creations.
Also, I did not have my own utility classes and I would copy the same code to read and parse the file from the previous day.
All of the things I have mentioned are not huge issues but it was still bothering me.That's why this year, I have decided to do things a little differently.
## 🛠️ Proper workspace
I have created proper structure for my project and wrote my own utility classes to automatically generate the needed files, easily read the inputs and run the code.
Thanks to that, I can jump straight to solving the daily challenge instead of losing time setting up everything.What the workspace takes care of:
- Automatically generating empty input files (example, input, input2, etc.) for the current day. I still need to manually copy my input data from AOC website inside the file but that takes like 5 seconds. *I am not so good at solving AOC programming challenges that these lost seconds matter anyway :)*
- Automatically generating a skeleton solver file (C# class file) for the current day:
```csharp
namespace aoc_2023.src.dayXX
{
public class DayXXSolver : AocSolver
{
// Link to the puzzle: https://adventofcode.com/2023/day/XX
public override int Day => XX;
public override int Part => 1;
public override void Solve()
{
string[] input = ReadInput("input");
string[] lines = ReadInputLines("input");
Console.WriteLine($"Result for Part {Part} is ");
}
}
}
```
- When the project is run, the daily solver will be called and its code will be executed automatically
- Once I am done with the first part of the challenge, I just need to change a boolean in the main function and the solver for part 2 will be automatically generated next time I run the project
- The solver created for part 2 is a direct copy of the solver file for part 1 but with some tiny adjustments (mostly file/class name and `Part` value)## 💼 Workflow
When it's time to tackle the daily challenges:
- I run the app once to generate the daily files (data folder and solver skeleton for part 1)
- I read the challenge description and start implementing a solution
- I test the solution against example data and make sure it works before testing with my own input
- Once I get the golden star for part 1, I push the code to Git
- Then, I change a boolean in my main function to indicate that I am ready for part 2
- Upon running the project, the solver for part 2 gets automatically generated and it contains the same code as part 1
- I tweak the code of the new generated solver so that it works for part 2
- I test with my inputs and edit the code until I find something that works and I get my second star
- Finally, I push code to Git