Skip to content

Commit d0f51e9

Browse files
committed
2025/01
1 parent 73ec449 commit d0f51e9

9 files changed

Lines changed: 145 additions & 3 deletions

File tree

.vscode/launch.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"request": "launch",
1212
"preLaunchTask": "build",
1313
// If you have changed target frameworks, make sure to update the program path.
14-
"program": "${workspaceFolder}/bin/Debug/net10.0/adventofcode.dll",
14+
"program": "${workspaceFolder}/bin/Debug/net10.0/osx-arm64/adventofcode.dll",
1515
"args": ["${relativeFileDirname}"],
1616
"cwd": "${workspaceFolder}",
1717
// For more information about the 'console' field, see https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md#console-terminal-window

2025/Day01/README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
## --- Day 1: Secret Entrance ---
2+
The Elves have good news and bad news.
3+
4+
The good news is that they've discovered [project management](https://en.wikipedia.org/wiki/Project_management)! This has given them the tools they need to prevent their usual Christmas emergency. For example, they now know that the North Pole decorations need to be finished soon so that other critical tasks can start on time.
5+
6+
_Visit the website for the full story and [full puzzle](https://adventofcode.com/2025/day/1) description._
7+

2025/Day01/Solution.cs

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
namespace AdventOfCode.Y2025.Day01;
2+
3+
using System.Collections.Generic;
4+
using System.Linq;
5+
6+
[ProblemName("Secret Entrance")]
7+
class Solution : Solver {
8+
9+
public object PartOne(string input) => Dial(Parse(input)).Count(x => x == 0);
10+
public object PartTwo(string input) => Dial(Parse2(input)).Count(x => x == 0);
11+
12+
IEnumerable<int> Dial(IEnumerable<int> rotations) {
13+
int pos = 50;
14+
foreach (var rotation in rotations) {
15+
pos = (pos + rotation + 100) % 100;
16+
yield return pos;
17+
}
18+
}
19+
20+
IEnumerable<int> Parse(string input) =>
21+
from line in input.Split("\n")
22+
let d = line[0] == 'R' ? 1 : -1
23+
let a = int.Parse(line.Substring(1))
24+
select a * d;
25+
26+
IEnumerable<int> Parse2(string input) =>
27+
from line in input.Split("\n")
28+
let d = line[0] == 'R' ? 1 : -1
29+
let a = int.Parse(line.Substring(1))
30+
from i in Enumerable.Range(0, a)
31+
select d;
32+
}

2025/Day01/input.in

16.2 KB
Binary file not shown.

2025/Day01/input.refout

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
964
2+
5872

2025/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Advent of Code (2025)
2+
Check out https://adventofcode.com/2025.
3+
4+
<a href="https://adventofcode.com/2025"><img src="calendar.svg" width="80%" /></a>

2025/SplashScreen.cs

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
using System;
2+
3+
namespace AdventOfCode.Y2025;
4+
5+
class SplashScreenImpl : SplashScreen {
6+
7+
public void Show() {
8+
9+
var color = Console.ForegroundColor;
10+
Write(0xcc00, false, " ▄█▄ ▄▄█ ▄ ▄ ▄▄▄ ▄▄ ▄█▄ ▄▄▄ ▄█ ▄▄ ▄▄▄ ▄▄█ ▄▄▄\n █▄█ █ █ █ █ █▄█ █ █ █ █ █ █▄ ");
11+
Write(0xcc00, false, " █ █ █ █ █ █▄█\n █ █ █▄█ ▀▄▀ █▄▄ █ █ █▄ █▄█ █ █▄ █▄█ █▄█ █▄▄ /* 2025 */\n \n ");
12+
Write(0xcc00, false, " ");
13+
Write(0xffffff, false, "'.'. ____ ' ... ");
14+
Write(0xffff66, true, "* ");
15+
Write(0xffffff, false, "' . .' .. ");
16+
Write(0xff9900, false, "<");
17+
Write(0xffffff, false, "o ' . \n ________/");
18+
Write(0x999999, false, "O___");
19+
Write(0xffffff, false, "\\__________");
20+
Write(0xff0000, false, "|");
21+
Write(0xffffff, false, "_________________O______ ");
22+
Write(0xcccccc, false, " 1 ");
23+
Write(0xffff66, false, "**\n ");
24+
Write(0x333333, false, " _______||_________ \n | _@__ || _o_ | ");
25+
Write(0x333333, false, " ");
26+
Write(0x666666, false, " 2\n ");
27+
Write(0x333333, false, " |_&_%__||_oo__^=_[ \n ");
28+
Write(0x333333, false, " ");
29+
Write(0x666666, false, " 3\n \n ");
30+
Write(0x666666, false, " 4\n ");
31+
Write(0x666666, false, " \n 5\n ");
32+
Write(0x666666, false, " \n ");
33+
Write(0x666666, false, "6\n \n ");
34+
Write(0x666666, false, " 7\n ");
35+
Write(0x666666, false, " \n 8\n ");
36+
Write(0x666666, false, " \n 9");
37+
Write(0x666666, false, "\n \n ");
38+
Write(0x666666, false, " 10\n ");
39+
Write(0x666666, false, " \n 11\n ");
40+
Write(0x666666, false, " \n 12\n");
41+
Write(0x666666, false, " \n");
42+
43+
Console.ForegroundColor = color;
44+
Console.WriteLine();
45+
}
46+
47+
private static void Write(int rgb, bool bold, string text){
48+
Console.Write($"\u001b[38;2;{(rgb>>16)&255};{(rgb>>8)&255};{rgb&255}{(bold ? ";1" : "")}m{text}");
49+
}
50+
}

2025/calendar.svg

Lines changed: 45 additions & 0 deletions
Loading

adventofcode.csproj

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,12 @@
44
<TargetFramework>net10.0</TargetFramework>
55
<LangVersion>14</LangVersion>
66
<CheckForOverflowUnderflow>true</CheckForOverflowUnderflow>
7-
<UseAppHost>false</UseAppHost>
7+
<SelfContained>true</SelfContained>
8+
<!-- <UseAppHost>true</UseAppHost> -->
9+
<EnableDynamicCodeSupport>true</EnableDynamicCodeSupport>
810
</PropertyGroup>
911
<ItemGroup>
1012
<PackageReference Include="AngleSharp" Version="0.14.0" />
1113
<PackageReference Include="AngleSharp.Css" Version="0.14.0" />
1214
</ItemGroup>
13-
</Project>
15+
</Project>

0 commit comments

Comments
 (0)