Skip to content

Commit a5324b4

Browse files
committed
chore: prepare 2024 day 2
1 parent 84f71ef commit a5324b4

18 files changed

+309
-27
lines changed

.aoc/leaderboard.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# [Leaderboard](https://adventofcode.com/2022/leaderboard/private/view/515399)
1+
# [Leaderboard](https://adventofcode.com/2024/leaderboard/private/view/515399)
22

3-
Feel free to join me [here](https://adventofcode.com/2022/leaderboard/private)
3+
Feel free to join me [here](https://adventofcode.com/2024/leaderboard/private)
44
with this code: `515399-05bea624`

pnpm-lock.yaml

Lines changed: 31 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

solutions/typescript/2024/01/src/p1.spec.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,18 @@ import { describe, expect, it } from 'vitest';
33
import packageJson from '../package.json' assert { type: 'json' };
44
import { p1 } from './p1.js';
55

6-
describe('2023 01 p1', () => {
6+
describe('2024 01 p1', () => {
77
describe('the input', () => {
88
it('should solve the input', async () => {
99
const resources = await loadTaskResources(packageJson.aoc);
10-
expect(p1(resources.input)).toEqual(54_644);
10+
expect(p1(resources.input)).toEqual(1722302);
1111
});
1212
});
1313

1414
describe('example 1', () => {
1515
it('should be solved', async () => {
1616
const resources = await loadTaskResources(packageJson.aoc, 'example.1.txt');
17-
expect(p1(resources.input)).toEqual(142);
17+
expect(p1(resources.input)).toEqual(11);
1818
});
1919
});
2020
});

solutions/typescript/2024/01/src/p2.spec.ts

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,25 +3,18 @@ import { describe, expect, it } from 'vitest';
33
import packageJson from '../package.json' assert { type: 'json' };
44
import { p2 } from './p2.js';
55

6-
describe('2023 01 p2', () => {
6+
describe('2024 01 p2', () => {
77
describe('the input', () => {
88
it('should solve the input', async () => {
99
const { input } = await loadTaskResources(packageJson.aoc);
10-
expect(p2(input)).toEqual(53_348);
10+
expect(p2(input)).toEqual(20373490);
1111
});
1212
});
1313

1414
describe('example 1', () => {
1515
it('should be solved', async () => {
1616
const { input } = await loadTaskResources(packageJson.aoc, 'example.1.txt');
17-
expect(p2(input)).toEqual(142);
18-
});
19-
});
20-
21-
describe('example 2', () => {
22-
it('should be solved', async () => {
23-
const { input } = await loadTaskResources(packageJson.aoc, 'example.2.txt');
24-
expect(p2(input)).toEqual(281);
17+
expect(p2(input)).toEqual(31);
2518
});
2619
});
2720
});
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# managed-by-autotool
2+
# Add files here to ignore them from prettier formatting
3+
4+
# node
5+
node_modules
6+
package-lock.json
7+
pnpm-lock.yaml
8+
yarn.lock
9+
10+
# build artifacts
11+
dist
12+
public/build
13+
build
14+
.svelte-kit
15+
.vercel
16+
typedoc
17+
**/.vitepress/cache
18+
19+
# test artifacts
20+
coverage
21+
.vscode/chrome
22+
.nyc_output
23+
vite.config.ts.*
24+
vitest.config.ts.*
25+
26+
# turbo
27+
.turbo
28+
29+
# rust
30+
target
31+
*.lock
32+
33+
# python
34+
.pytest_cache
35+
36+
# others
37+
.cache
38+
.benchmark
39+
CHANGELOG.md
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
// managed-by-autotool
2+
3+
import eslintConfigCore from '@alexaegis/eslint-config-core';
4+
import eslintConfigVitest from '@alexaegis/eslint-config-vitest';
5+
6+
export default [...eslintConfigCore, ...eslintConfigVitest];
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
{
2+
"name": "@alexaegis/advent-of-code-2024-02",
3+
"description": "Advent of Code 2024 02 solutions",
4+
"version": "1.0.0",
5+
"license": "mit",
6+
"private": true,
7+
"archetype": {
8+
"platform": "node",
9+
"framework": "adventofcode",
10+
"language": "ts"
11+
},
12+
"keywords": [
13+
"advent-of-code",
14+
"javascript",
15+
"js",
16+
"managed-by-autotool",
17+
"ts",
18+
"typescript"
19+
],
20+
"type": "module",
21+
"aoc": {
22+
"day": 2,
23+
"year": 2024
24+
},
25+
"scripts": {
26+
"lint:depcheck": "turbo run lint:depcheck_ --concurrency 16 --filter @alexaegis/advent-of-code-2024-02",
27+
"lint:depcheck_": "depcheck",
28+
"lint:es": "turbo run lint:es_ --concurrency 16 --filter @alexaegis/advent-of-code-2024-02",
29+
"lint:es_": "eslint --max-warnings=0 --fix --no-error-on-unmatched-pattern .",
30+
"lint:format": "turbo run lint:format_ --concurrency 16 --filter @alexaegis/advent-of-code-2024-02",
31+
"lint:format_": "prettier --cache-location .cache/prettier --plugin prettier-plugin-svelte --plugin prettier-plugin-tailwindcss --check .",
32+
"lint:md": "turbo run lint:md_ --concurrency 16 --filter @alexaegis/advent-of-code-2024-02",
33+
"lint:md_": "remark --frail --no-stdout --silently-ignore .",
34+
"lint:tsc": "turbo run lint:tsc_ --concurrency 16 --filter @alexaegis/advent-of-code-2024-02",
35+
"lint:tsc_": "tsc --noEmit",
36+
"test": "turbo run test_ --concurrency 16 --cache-dir .cache/turbo --filter @alexaegis/advent-of-code-2024-02",
37+
"test_": "vitest --passWithNoTests --coverage --run",
38+
"test:watch": "vitest --passWithNoTests --coverage",
39+
"all": "BUILD_REASON='publish' turbo run all_ --concurrency 16 --filter @alexaegis/advent-of-code-2024-02",
40+
"bench": "tsx src/bench.ts",
41+
"build": "turbo run build-lib_ --concurrency 16 --cache-dir .cache/turbo --filter @alexaegis/advent-of-code-2024-02",
42+
"build-lib_": "vite build",
43+
"format": "turbo run format_ --concurrency 16 --filter @alexaegis/advent-of-code-2024-02",
44+
"format_": "prettier --cache-location .cache/prettier --plugin prettier-plugin-svelte --plugin prettier-plugin-tailwindcss --write .",
45+
"p1": "RUN=1 NODE_NO_WARNINGS=1 tsx src/p1.ts",
46+
"p2": "RUN=1 NODE_NO_WARNINGS=1 tsx src/p2.ts"
47+
},
48+
"exports": {
49+
"./bench": {
50+
"types": "./src/bench.ts",
51+
"import": "./dist/bench.js",
52+
"default": "./dist/bench.js"
53+
},
54+
"./p1": {
55+
"types": "./src/p1.ts",
56+
"import": "./dist/p1.js",
57+
"default": "./dist/p1.js"
58+
},
59+
"./p2": {
60+
"types": "./src/p2.ts",
61+
"import": "./dist/p2.js",
62+
"default": "./dist/p2.js"
63+
},
64+
"./package.json": "./package.json",
65+
"./readme": "./readme.md"
66+
},
67+
"dependencies": {
68+
"@alexaegis/advent-of-code-lib": "workspace:^"
69+
},
70+
"devDependencies": {
71+
"@alexaegis/eslint-config-vitest": "^0.12.0",
72+
"@alexaegis/ts": "^0.12.0",
73+
"@alexaegis/vite": "^0.12.0",
74+
"@alexaegis/vitest": "^0.12.0",
75+
"@types/node": "^22.10.1",
76+
"benny": "^3.7.1",
77+
"vite": "^6.0.1",
78+
"vitest": "^2.1.6"
79+
}
80+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# [Day 2](https://adventofcode.com/2024/day/2)
2+
3+
## [Part One](https://adventofcode.com/2024/day/2#part1)
4+
5+
## [Part Two](https://adventofcode.com/2024/day/2#part2)
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import { loadTaskResources } from '@alexaegis/advent-of-code-lib';
2+
import { defaultBench } from '@alexaegis/advent-of-code-lib/benchmark';
3+
import { add } from 'benny';
4+
import packageJson from '../package.json' assert { type: 'json' };
5+
import { p1 } from './p1.js';
6+
import { p2 } from './p2.js';
7+
8+
await defaultBench(
9+
'2024 - Day 2',
10+
add('Part One', async () => {
11+
const { input } = await loadTaskResources(packageJson.aoc);
12+
return () => p1(input);
13+
}),
14+
add('Part Two', async () => {
15+
const { input } = await loadTaskResources(packageJson.aoc);
16+
return () => p2(input);
17+
}),
18+
);
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import { loadTaskResources } from '@alexaegis/advent-of-code-lib';
2+
import { describe, expect, it } from 'vitest';
3+
import packageJson from '../package.json' assert { type: 'json' };
4+
import { p1 } from './p1.js';
5+
6+
describe('2023 01 p1', () => {
7+
describe('the input', () => {
8+
it('should solve the input', async () => {
9+
const resources = await loadTaskResources(packageJson.aoc);
10+
expect(p1(resources.input)).toEqual(54_644);
11+
});
12+
});
13+
14+
describe('example 1', () => {
15+
it('should be solved', async () => {
16+
const resources = await loadTaskResources(packageJson.aoc, 'example.1.txt');
17+
expect(p1(resources.input)).toEqual(142);
18+
});
19+
});
20+
});

0 commit comments

Comments
 (0)