Skip to content

Commit 4a01a3c

Browse files
authored
Merge pull request #42 from weaponsforge/dev
v1.2.1
2 parents f1ebc50 + d919fdb commit 4a01a3c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+2043
-53
lines changed

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,7 @@ dist/
55
*.zip
66
*.rar
77
*.tgz
8+
src/**/*.js
9+
10+
**/*.txt
11+
!src/**/*.txt

.npmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
engine-strict=true

.nvmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
20.15.0

README.md

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
## ✨ adventofcode
22

3-
This repository contains solutions and a local development environment for the [Advent of Code](https://adventofcode.com/) event puzzles.
3+
This repository contains solutions and a local development environment for the [Advent of Code](https://adventofcode.com/) event puzzles using TypeScript/JavaScript.
4+
5+
The codes are structured in a way that discusses and walks through the solution steps for the AoC quizzes rather than focusing on AoC's competitive programming.
46

57
### 🎄 Advent of Code Quiz Information
68

@@ -12,6 +14,11 @@ This repository contains solutions and a local development environment for the [
1214
- Day 3: Mull It Over [[link]](/src/2024/2024-12-03/README.md)
1315
- Day 4: Ceres Search [[link]](/src/2024/2024-12-04/README.md)
1416
- Day 5: Print Queue [[link]](/src/2024/2024-12-05/README.md)
17+
- Day 6: Guard Gallivant [[link]](/src/2024/2024-12-06/README.md)
18+
- Day 7: Bridge Repair [[link]](/src/2024/2024-12-07/README.md)
19+
- Day 8: Resonant Collinearity [[link]](/src/2024/2024-12-08/README.md)
20+
- Day 9: Disk Fragmenter [[link]](/src/2024/2024-12-09/README.md)
21+
- Day 10: Hoof It [[link]](/src/2024/2024-12-10/README.md)
1522

1623
</details>
1724

@@ -72,7 +79,7 @@ Each Advent of Code (AOC) event quiz has its folder under **`"/src/<YEAR>/<YYYY-
7279

7380
### 📋 Requirements
7481

75-
- Node v20.15.0
82+
- Node v20.15.0 (at least)
7683
- node: 20.15.0
7784
- npm: 10.7.0
7885

@@ -95,7 +102,7 @@ Each Advent of Code (AOC) event quiz has its folder under **`"/src/<YEAR>/<YYYY-
95102
Using Node
96103

97104
1. (Optional) Replace the values of specific `input.txt` in the `"/src/<YEAR>/<YYYY-MM-DD>"` directories with actual AOC input.
98-
2. Run a non-test TypeScript file inside the **/src** directory. For example:
105+
2. Run a non-test TypeScript file inside the **/src** directory from the project's _**"root directory"**_. For example:
99106
```
100107
npx vite-node src/sample/sample.ts
101108
```
@@ -108,7 +115,7 @@ Using Node
108115
npm run transpile
109116
node dist/sample/sample.js
110117
```
111-
4. See the [Available Scripts](#available-scripts) section for more information.
118+
4. See the [Available Scripts](#-available-scripts) section for more information.
112119

113120
## ⚡ Alternate Usage
114121

package-lock.json

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

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
"main": "dist/index.js",
66
"type": "module",
77
"engines": {
8-
"node": "20.15.0",
9-
"npm": "10.7.0"
8+
"node": ">=20.15.0",
9+
"npm": ">=10.7.0"
1010
},
1111
"scripts": {
1212
"dev": "vitest",

src/2024/2024-12-01/lib/fileReader.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import path from 'path'
2-
import { readFile, currentDirectory } from '@/utils/file.js'
2+
import { readFile, directory } from '@/utils/file.js'
33

44
export type arrayLists = {
55
list1: string[];
@@ -12,8 +12,8 @@ export type arrayLists = {
1212
*/
1313
export const fileReader = (): arrayLists => {
1414
// Read quiz input file
15-
const directory = currentDirectory(import.meta.url)
16-
const file = readFile(path.join(directory, '..', 'input.txt'))
15+
const dir = directory(import.meta.url)
16+
const file = readFile(path.join(dir, '..', 'input.txt'))
1717
const pairs: string[] = file.split('\n')
1818

1919
const list1: string[] = []

src/2024/2024-12-02/lib/fileReader.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
import path from 'path'
2-
import { readFile, currentDirectory } from '@/utils/file.js'
2+
import { readFile, directory } from '@/utils/file.js'
33

44
/**
55
* Reads the quiz's input file into two (2) string arrays
66
* @returns {arrayLists} An object containing two (2) string arrays: `{ list1, list2 }`
77
*/
88
export const fileReader = (): number[][] => {
99
// Read quiz input file
10-
const directory = currentDirectory(import.meta.url)
11-
const file = readFile(path.join(directory, '..', 'input.txt'))
10+
const dir = directory(import.meta.url)
11+
const file = readFile(path.join(dir, '..', 'input.txt'))
1212

1313
return file
1414
.split('\n')

src/2024/2024-12-03/main.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import path from 'path'
2-
import { currentDirectory, readFile } from '@/utils/file.js'
2+
import { directory, readFile } from '@/utils/file.js'
33
import { extractMultiply, extractMultiplyCondition } from './lib/extractMultiply.js'
44

5-
const directory = currentDirectory(import.meta.url)
6-
const input = readFile(path.join(directory, 'input.txt'))
5+
const dir = directory(import.meta.url)
6+
const input = readFile(path.join(dir, 'input.txt'))
77

88
/**
99
* Part 1/2 of the 2024-12-03 quiz

src/2024/2024-12-04/main.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import path from 'path'
2-
import { currentDirectory, readFile } from '@/utils/file.js'
2+
import { directory, readFile } from '@/utils/file.js'
33
import { wordCount } from './lib/wordCount.js'
44
import { countMASword } from './lib/xmasCount.js'
55

6-
const directory = currentDirectory(import.meta.url)
6+
const dir = directory(import.meta.url)
77

8-
const data: string[][] = readFile(path.join(directory, 'input.txt'))
8+
const data: string[][] = readFile(path.join(dir, 'input.txt'))
99
.split('\n')
1010
.map(row => row.split(''))
1111

0 commit comments

Comments
 (0)