mirror of
https://github.com/seigler/aoc2023
synced 2025-07-25 13:56:10 +00:00
days 1 and 2 from last year
This commit is contained in:
commit
a71ae9c4d7
15 changed files with 2167 additions and 0 deletions
357
.aocrunner.json
Normal file
357
.aocrunner.json
Normal file
|
@ -0,0 +1,357 @@
|
|||
{
|
||||
"version": 1,
|
||||
"year": 2023,
|
||||
"language": "ts",
|
||||
"days": [
|
||||
{
|
||||
"part1": {
|
||||
"solved": true,
|
||||
"result": "54561",
|
||||
"attempts": [],
|
||||
"time": 0.368334
|
||||
},
|
||||
"part2": {
|
||||
"solved": true,
|
||||
"result": "54076",
|
||||
"attempts": [],
|
||||
"time": 1.512083
|
||||
}
|
||||
},
|
||||
{
|
||||
"part1": {
|
||||
"solved": true,
|
||||
"result": "2447",
|
||||
"attempts": [],
|
||||
"time": 0.772417
|
||||
},
|
||||
"part2": {
|
||||
"solved": true,
|
||||
"result": "56322",
|
||||
"attempts": [],
|
||||
"time": 0.520292
|
||||
}
|
||||
},
|
||||
{
|
||||
"part1": {
|
||||
"solved": false,
|
||||
"result": null,
|
||||
"attempts": [],
|
||||
"time": null
|
||||
},
|
||||
"part2": {
|
||||
"solved": false,
|
||||
"result": null,
|
||||
"attempts": [],
|
||||
"time": null
|
||||
}
|
||||
},
|
||||
{
|
||||
"part1": {
|
||||
"solved": false,
|
||||
"result": null,
|
||||
"attempts": [],
|
||||
"time": null
|
||||
},
|
||||
"part2": {
|
||||
"solved": false,
|
||||
"result": null,
|
||||
"attempts": [],
|
||||
"time": null
|
||||
}
|
||||
},
|
||||
{
|
||||
"part1": {
|
||||
"solved": false,
|
||||
"result": null,
|
||||
"attempts": [],
|
||||
"time": null
|
||||
},
|
||||
"part2": {
|
||||
"solved": false,
|
||||
"result": null,
|
||||
"attempts": [],
|
||||
"time": null
|
||||
}
|
||||
},
|
||||
{
|
||||
"part1": {
|
||||
"solved": false,
|
||||
"result": null,
|
||||
"attempts": [],
|
||||
"time": null
|
||||
},
|
||||
"part2": {
|
||||
"solved": false,
|
||||
"result": null,
|
||||
"attempts": [],
|
||||
"time": null
|
||||
}
|
||||
},
|
||||
{
|
||||
"part1": {
|
||||
"solved": false,
|
||||
"result": null,
|
||||
"attempts": [],
|
||||
"time": null
|
||||
},
|
||||
"part2": {
|
||||
"solved": false,
|
||||
"result": null,
|
||||
"attempts": [],
|
||||
"time": null
|
||||
}
|
||||
},
|
||||
{
|
||||
"part1": {
|
||||
"solved": false,
|
||||
"result": null,
|
||||
"attempts": [],
|
||||
"time": null
|
||||
},
|
||||
"part2": {
|
||||
"solved": false,
|
||||
"result": null,
|
||||
"attempts": [],
|
||||
"time": null
|
||||
}
|
||||
},
|
||||
{
|
||||
"part1": {
|
||||
"solved": false,
|
||||
"result": null,
|
||||
"attempts": [],
|
||||
"time": null
|
||||
},
|
||||
"part2": {
|
||||
"solved": false,
|
||||
"result": null,
|
||||
"attempts": [],
|
||||
"time": null
|
||||
}
|
||||
},
|
||||
{
|
||||
"part1": {
|
||||
"solved": false,
|
||||
"result": null,
|
||||
"attempts": [],
|
||||
"time": null
|
||||
},
|
||||
"part2": {
|
||||
"solved": false,
|
||||
"result": null,
|
||||
"attempts": [],
|
||||
"time": null
|
||||
}
|
||||
},
|
||||
{
|
||||
"part1": {
|
||||
"solved": false,
|
||||
"result": null,
|
||||
"attempts": [],
|
||||
"time": null
|
||||
},
|
||||
"part2": {
|
||||
"solved": false,
|
||||
"result": null,
|
||||
"attempts": [],
|
||||
"time": null
|
||||
}
|
||||
},
|
||||
{
|
||||
"part1": {
|
||||
"solved": false,
|
||||
"result": null,
|
||||
"attempts": [],
|
||||
"time": null
|
||||
},
|
||||
"part2": {
|
||||
"solved": false,
|
||||
"result": null,
|
||||
"attempts": [],
|
||||
"time": null
|
||||
}
|
||||
},
|
||||
{
|
||||
"part1": {
|
||||
"solved": false,
|
||||
"result": null,
|
||||
"attempts": [],
|
||||
"time": null
|
||||
},
|
||||
"part2": {
|
||||
"solved": false,
|
||||
"result": null,
|
||||
"attempts": [],
|
||||
"time": null
|
||||
}
|
||||
},
|
||||
{
|
||||
"part1": {
|
||||
"solved": false,
|
||||
"result": null,
|
||||
"attempts": [],
|
||||
"time": null
|
||||
},
|
||||
"part2": {
|
||||
"solved": false,
|
||||
"result": null,
|
||||
"attempts": [],
|
||||
"time": null
|
||||
}
|
||||
},
|
||||
{
|
||||
"part1": {
|
||||
"solved": false,
|
||||
"result": null,
|
||||
"attempts": [],
|
||||
"time": null
|
||||
},
|
||||
"part2": {
|
||||
"solved": false,
|
||||
"result": null,
|
||||
"attempts": [],
|
||||
"time": null
|
||||
}
|
||||
},
|
||||
{
|
||||
"part1": {
|
||||
"solved": false,
|
||||
"result": null,
|
||||
"attempts": [],
|
||||
"time": null
|
||||
},
|
||||
"part2": {
|
||||
"solved": false,
|
||||
"result": null,
|
||||
"attempts": [],
|
||||
"time": null
|
||||
}
|
||||
},
|
||||
{
|
||||
"part1": {
|
||||
"solved": false,
|
||||
"result": null,
|
||||
"attempts": [],
|
||||
"time": null
|
||||
},
|
||||
"part2": {
|
||||
"solved": false,
|
||||
"result": null,
|
||||
"attempts": [],
|
||||
"time": null
|
||||
}
|
||||
},
|
||||
{
|
||||
"part1": {
|
||||
"solved": false,
|
||||
"result": null,
|
||||
"attempts": [],
|
||||
"time": null
|
||||
},
|
||||
"part2": {
|
||||
"solved": false,
|
||||
"result": null,
|
||||
"attempts": [],
|
||||
"time": null
|
||||
}
|
||||
},
|
||||
{
|
||||
"part1": {
|
||||
"solved": false,
|
||||
"result": null,
|
||||
"attempts": [],
|
||||
"time": null
|
||||
},
|
||||
"part2": {
|
||||
"solved": false,
|
||||
"result": null,
|
||||
"attempts": [],
|
||||
"time": null
|
||||
}
|
||||
},
|
||||
{
|
||||
"part1": {
|
||||
"solved": false,
|
||||
"result": null,
|
||||
"attempts": [],
|
||||
"time": null
|
||||
},
|
||||
"part2": {
|
||||
"solved": false,
|
||||
"result": null,
|
||||
"attempts": [],
|
||||
"time": null
|
||||
}
|
||||
},
|
||||
{
|
||||
"part1": {
|
||||
"solved": false,
|
||||
"result": null,
|
||||
"attempts": [],
|
||||
"time": null
|
||||
},
|
||||
"part2": {
|
||||
"solved": false,
|
||||
"result": null,
|
||||
"attempts": [],
|
||||
"time": null
|
||||
}
|
||||
},
|
||||
{
|
||||
"part1": {
|
||||
"solved": false,
|
||||
"result": null,
|
||||
"attempts": [],
|
||||
"time": null
|
||||
},
|
||||
"part2": {
|
||||
"solved": false,
|
||||
"result": null,
|
||||
"attempts": [],
|
||||
"time": null
|
||||
}
|
||||
},
|
||||
{
|
||||
"part1": {
|
||||
"solved": false,
|
||||
"result": null,
|
||||
"attempts": [],
|
||||
"time": null
|
||||
},
|
||||
"part2": {
|
||||
"solved": false,
|
||||
"result": null,
|
||||
"attempts": [],
|
||||
"time": null
|
||||
}
|
||||
},
|
||||
{
|
||||
"part1": {
|
||||
"solved": false,
|
||||
"result": null,
|
||||
"attempts": [],
|
||||
"time": null
|
||||
},
|
||||
"part2": {
|
||||
"solved": false,
|
||||
"result": null,
|
||||
"attempts": [],
|
||||
"time": null
|
||||
}
|
||||
},
|
||||
{
|
||||
"part1": {
|
||||
"solved": false,
|
||||
"result": null,
|
||||
"attempts": [],
|
||||
"time": null
|
||||
},
|
||||
"part2": {
|
||||
"solved": false,
|
||||
"result": null,
|
||||
"attempts": [],
|
||||
"time": null
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
10
.gitignore
vendored
Normal file
10
.gitignore
vendored
Normal file
|
@ -0,0 +1,10 @@
|
|||
node_modules
|
||||
*.temp.*
|
||||
*/**/*.temp.*
|
||||
*/**/input.txt
|
||||
*.log
|
||||
*/**/*.log
|
||||
.idea
|
||||
.vscode
|
||||
.env
|
||||
dist
|
2
.mise.toml
Normal file
2
.mise.toml
Normal file
|
@ -0,0 +1,2 @@
|
|||
[tools]
|
||||
yarn = "latest"
|
1
.prettierignore
Normal file
1
.prettierignore
Normal file
|
@ -0,0 +1 @@
|
|||
lib
|
11
.prettierrc.json
Normal file
11
.prettierrc.json
Normal file
|
@ -0,0 +1,11 @@
|
|||
{
|
||||
"arrowParens": "always",
|
||||
"bracketSpacing": true,
|
||||
"printWidth": 80,
|
||||
"proseWrap": "preserve",
|
||||
"semi": false,
|
||||
"singleQuote": false,
|
||||
"tabWidth": 2,
|
||||
"useTabs": false,
|
||||
"trailingComma": "all"
|
||||
}
|
254
README.md
Normal file
254
README.md
Normal file
|
@ -0,0 +1,254 @@
|
|||
<!-- Entries between SOLUTIONS and RESULTS tags are auto-generated -->
|
||||
|
||||
[](https://adventofcode.com/2023)
|
||||
[](https://nodejs.org/en/download/)
|
||||

|
||||
[](https://github.com/caderek/aocrunner)
|
||||
|
||||
# 🎄 Advent of Code 2023 🎄
|
||||
|
||||
## Solutions
|
||||
|
||||
<!--SOLUTIONS-->
|
||||
|
||||
[](src/day01)
|
||||
[](src/day02)
|
||||

|
||||

|
||||

|
||||

|
||||

|
||||

|
||||

|
||||

|
||||

|
||||

|
||||

|
||||

|
||||

|
||||

|
||||

|
||||

|
||||

|
||||

|
||||

|
||||

|
||||

|
||||

|
||||

|
||||
|
||||
<!--/SOLUTIONS-->
|
||||
|
||||
_Click a badge to go to the specific day._
|
||||
|
||||
---
|
||||
|
||||
## Installation
|
||||
|
||||
```
|
||||
yarn
|
||||
```
|
||||
|
||||
## Running in dev mode
|
||||
|
||||
```
|
||||
yarn start <day>
|
||||
```
|
||||
|
||||
Example:
|
||||
|
||||
```
|
||||
yarn start 1
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Results
|
||||
|
||||
<!--RESULTS-->
|
||||
|
||||
```
|
||||
Day 01
|
||||
Time part 1: 0.368ms
|
||||
Time part 2: 1.512ms
|
||||
Both parts: 1.88ms
|
||||
```
|
||||
|
||||
```
|
||||
Day 02
|
||||
Time part 1: 0.772ms
|
||||
Time part 2: 0.52ms
|
||||
Both parts: 1.293ms
|
||||
```
|
||||
|
||||
```
|
||||
Day 03
|
||||
Time part 1: -
|
||||
Time part 2: -
|
||||
Both parts: -
|
||||
```
|
||||
|
||||
```
|
||||
Day 04
|
||||
Time part 1: -
|
||||
Time part 2: -
|
||||
Both parts: -
|
||||
```
|
||||
|
||||
```
|
||||
Day 05
|
||||
Time part 1: -
|
||||
Time part 2: -
|
||||
Both parts: -
|
||||
```
|
||||
|
||||
```
|
||||
Day 06
|
||||
Time part 1: -
|
||||
Time part 2: -
|
||||
Both parts: -
|
||||
```
|
||||
|
||||
```
|
||||
Day 07
|
||||
Time part 1: -
|
||||
Time part 2: -
|
||||
Both parts: -
|
||||
```
|
||||
|
||||
```
|
||||
Day 08
|
||||
Time part 1: -
|
||||
Time part 2: -
|
||||
Both parts: -
|
||||
```
|
||||
|
||||
```
|
||||
Day 09
|
||||
Time part 1: -
|
||||
Time part 2: -
|
||||
Both parts: -
|
||||
```
|
||||
|
||||
```
|
||||
Day 10
|
||||
Time part 1: -
|
||||
Time part 2: -
|
||||
Both parts: -
|
||||
```
|
||||
|
||||
```
|
||||
Day 11
|
||||
Time part 1: -
|
||||
Time part 2: -
|
||||
Both parts: -
|
||||
```
|
||||
|
||||
```
|
||||
Day 12
|
||||
Time part 1: -
|
||||
Time part 2: -
|
||||
Both parts: -
|
||||
```
|
||||
|
||||
```
|
||||
Day 13
|
||||
Time part 1: -
|
||||
Time part 2: -
|
||||
Both parts: -
|
||||
```
|
||||
|
||||
```
|
||||
Day 14
|
||||
Time part 1: -
|
||||
Time part 2: -
|
||||
Both parts: -
|
||||
```
|
||||
|
||||
```
|
||||
Day 15
|
||||
Time part 1: -
|
||||
Time part 2: -
|
||||
Both parts: -
|
||||
```
|
||||
|
||||
```
|
||||
Day 16
|
||||
Time part 1: -
|
||||
Time part 2: -
|
||||
Both parts: -
|
||||
```
|
||||
|
||||
```
|
||||
Day 17
|
||||
Time part 1: -
|
||||
Time part 2: -
|
||||
Both parts: -
|
||||
```
|
||||
|
||||
```
|
||||
Day 18
|
||||
Time part 1: -
|
||||
Time part 2: -
|
||||
Both parts: -
|
||||
```
|
||||
|
||||
```
|
||||
Day 19
|
||||
Time part 1: -
|
||||
Time part 2: -
|
||||
Both parts: -
|
||||
```
|
||||
|
||||
```
|
||||
Day 20
|
||||
Time part 1: -
|
||||
Time part 2: -
|
||||
Both parts: -
|
||||
```
|
||||
|
||||
```
|
||||
Day 21
|
||||
Time part 1: -
|
||||
Time part 2: -
|
||||
Both parts: -
|
||||
```
|
||||
|
||||
```
|
||||
Day 22
|
||||
Time part 1: -
|
||||
Time part 2: -
|
||||
Both parts: -
|
||||
```
|
||||
|
||||
```
|
||||
Day 23
|
||||
Time part 1: -
|
||||
Time part 2: -
|
||||
Both parts: -
|
||||
```
|
||||
|
||||
```
|
||||
Day 24
|
||||
Time part 1: -
|
||||
Time part 2: -
|
||||
Both parts: -
|
||||
```
|
||||
|
||||
```
|
||||
Day 25
|
||||
Time part 1: -
|
||||
Time part 2: -
|
||||
Both parts: -
|
||||
```
|
||||
|
||||
```
|
||||
Total stars: 4/50
|
||||
Total time: 3.173ms
|
||||
```
|
||||
|
||||
<!--/RESULTS-->
|
||||
|
||||
---
|
||||
|
||||
✨🎄🎁🎄🎅🎄🎁🎄✨
|
27
package.json
Normal file
27
package.json
Normal file
|
@ -0,0 +1,27 @@
|
|||
{
|
||||
"name": "aoc2023",
|
||||
"version": "1.0.0",
|
||||
"description": "Advent of Code 2023 - solutions",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"start": "aocrunner day",
|
||||
"build": "aocrunner build",
|
||||
"format": "prettier -w src",
|
||||
"update:readme": "aocrunner update:readme"
|
||||
},
|
||||
"keywords": [
|
||||
"aoc"
|
||||
],
|
||||
"author": "Joshua Seigler",
|
||||
"license": "ISC",
|
||||
"devDependencies": {
|
||||
"@types/node": "^16.11.6",
|
||||
"aocrunner": "^1.10.0",
|
||||
"eslint": "^9.16.0",
|
||||
"prettier": "^2.8.0"
|
||||
},
|
||||
"dependencies": {},
|
||||
"engines": {
|
||||
"node": ">=16.13.0"
|
||||
}
|
||||
}
|
9
src/day01/README.md
Normal file
9
src/day01/README.md
Normal file
|
@ -0,0 +1,9 @@
|
|||
# 🎄 Advent of Code 2023 - day 1 🎄
|
||||
|
||||
## Info
|
||||
|
||||
Task description: [link](https://adventofcode.com/2023/day/1)
|
||||
|
||||
## Notes
|
||||
|
||||
...
|
75
src/day01/index.ts
Normal file
75
src/day01/index.ts
Normal file
|
@ -0,0 +1,75 @@
|
|||
import run from "aocrunner"
|
||||
|
||||
const parseInput = (rawInput: string) => rawInput.split("\n")
|
||||
|
||||
const part1 = (rawInput: string) => {
|
||||
const input = parseInput(rawInput)
|
||||
return input.reduce((acc, line) => {
|
||||
const [left] = line.match(/\d/)!
|
||||
const [, right] = line.match(/.*(\d)/)!
|
||||
return acc + parseInt(left) * 10 + parseInt(right)
|
||||
}, 0)
|
||||
}
|
||||
|
||||
const part2 = (rawInput: string) => {
|
||||
const input = parseInput(rawInput)
|
||||
return input.reduce((acc, line) => {
|
||||
const [left] = line.match(
|
||||
/\d|one|two|three|four|five|six|seven|eight|nine/,
|
||||
)!
|
||||
const [, right] = line.match(
|
||||
/.*(\d|one|two|three|four|five|six|seven|eight|nine)/,
|
||||
)!
|
||||
const lookup = new Map<string, number>()
|
||||
for (let i = 1; i < 10; i++) {
|
||||
lookup.set(String(i), i)
|
||||
lookup.set(
|
||||
[
|
||||
"one",
|
||||
"two",
|
||||
"three",
|
||||
"four",
|
||||
"five",
|
||||
"six",
|
||||
"seven",
|
||||
"eight",
|
||||
"nine",
|
||||
][i - 1],
|
||||
i,
|
||||
)
|
||||
}
|
||||
return acc + lookup.get(left)! * 10 + lookup.get(right)!
|
||||
}, 0)
|
||||
}
|
||||
|
||||
run({
|
||||
part1: {
|
||||
tests: [
|
||||
{
|
||||
input: `1abc2
|
||||
pqr3stu8vwx
|
||||
a1b2c3d4e5f
|
||||
treb7uchet`,
|
||||
expected: 142,
|
||||
},
|
||||
],
|
||||
solution: part1,
|
||||
},
|
||||
part2: {
|
||||
tests: [
|
||||
{
|
||||
input: `two1nine
|
||||
eightwothree
|
||||
abcone2threexyz
|
||||
xtwone3four
|
||||
4nineeightseven2
|
||||
zoneight234
|
||||
7pqrstsixteen`,
|
||||
expected: 281,
|
||||
},
|
||||
],
|
||||
solution: part2,
|
||||
},
|
||||
trimTestInputs: true,
|
||||
onlyTests: false,
|
||||
})
|
9
src/day02/README.md
Normal file
9
src/day02/README.md
Normal file
|
@ -0,0 +1,9 @@
|
|||
# 🎄 Advent of Code 2023 - day 2 🎄
|
||||
|
||||
## Info
|
||||
|
||||
Task description: [link](https://adventofcode.com/2023/day/2)
|
||||
|
||||
## Notes
|
||||
|
||||
...
|
94
src/day02/index.ts
Normal file
94
src/day02/index.ts
Normal file
|
@ -0,0 +1,94 @@
|
|||
import run from "aocrunner"
|
||||
|
||||
const parseInput = (rawInput: string) => {
|
||||
const games = rawInput.split("\n").map((line) => {
|
||||
const [, number, contents] = line.match(/Game (\d+): (.*)/)!
|
||||
const gameNumber = parseInt(number)
|
||||
const handfuls = contents.split("; ").map((types) =>
|
||||
types.split(", ").map((set) => {
|
||||
const [qty, color] = set.split(" ")
|
||||
return {
|
||||
qty: parseInt(qty),
|
||||
color: color as "red" | "green" | "blue",
|
||||
}
|
||||
}),
|
||||
)
|
||||
return {
|
||||
gameNumber,
|
||||
handfuls,
|
||||
}
|
||||
})
|
||||
return games
|
||||
}
|
||||
|
||||
const part1 = (rawInput: string) => {
|
||||
const input = parseInput(rawInput)
|
||||
return input.reduce((total, game) => {
|
||||
const { gameNumber, handfuls } = game
|
||||
for (const handful of handfuls) {
|
||||
if (
|
||||
handful.some(
|
||||
(set) =>
|
||||
set.qty >
|
||||
{
|
||||
red: 12,
|
||||
green: 13,
|
||||
blue: 14,
|
||||
}[set.color],
|
||||
)
|
||||
) {
|
||||
return total
|
||||
}
|
||||
}
|
||||
return total + gameNumber
|
||||
}, 0)
|
||||
}
|
||||
|
||||
const part2 = (rawInput: string) => {
|
||||
const input = parseInput(rawInput)
|
||||
return input.reduce((total, game) => {
|
||||
const { handfuls } = game
|
||||
const minimums = {
|
||||
red: 0,
|
||||
green: 0,
|
||||
blue: 0,
|
||||
}
|
||||
for (const handful of handfuls) {
|
||||
for (const set of handful) {
|
||||
minimums[set.color] = Math.max(minimums[set.color] ?? 0, set.qty)
|
||||
}
|
||||
}
|
||||
return total + minimums.red * minimums.blue * minimums.green
|
||||
}, 0)
|
||||
}
|
||||
|
||||
run({
|
||||
part1: {
|
||||
tests: [
|
||||
{
|
||||
input: `Game 1: 3 blue, 4 red; 1 red, 2 green, 6 blue; 2 green
|
||||
Game 2: 1 blue, 2 green; 3 green, 4 blue, 1 red; 1 green, 1 blue
|
||||
Game 3: 8 green, 6 blue, 20 red; 5 blue, 4 red, 13 green; 5 green, 1 red
|
||||
Game 4: 1 green, 3 red, 6 blue; 3 green, 6 red; 3 green, 15 blue, 14 red
|
||||
Game 5: 6 red, 1 blue, 3 green; 2 blue, 1 red, 2 green`,
|
||||
expected: 8,
|
||||
},
|
||||
],
|
||||
solution: part1,
|
||||
},
|
||||
part2: {
|
||||
tests: [
|
||||
{
|
||||
input: `Game 1: 3 blue, 4 red; 1 red, 2 green, 6 blue; 2 green
|
||||
Game 2: 1 blue, 2 green; 3 green, 4 blue, 1 red; 1 green, 1 blue
|
||||
Game 3: 8 green, 6 blue, 20 red; 5 blue, 4 red, 13 green; 5 green, 1 red
|
||||
Game 4: 1 green, 3 red, 6 blue; 3 green, 6 red; 3 green, 15 blue, 14 red
|
||||
Game 5: 6 red, 1 blue, 3 green; 2 blue, 1 red, 2 green`,
|
||||
expected: 2286,
|
||||
},
|
||||
],
|
||||
solution: part2,
|
||||
},
|
||||
trimTestInputs: true,
|
||||
onlyTests: false,
|
||||
})
|
38
src/template/index.ts
Normal file
38
src/template/index.ts
Normal file
|
@ -0,0 +1,38 @@
|
|||
import run from "aocrunner"
|
||||
|
||||
const parseInput = (rawInput: string) => rawInput
|
||||
|
||||
const part1 = (rawInput: string) => {
|
||||
const input = parseInput(rawInput)
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
const part2 = (rawInput: string) => {
|
||||
const input = parseInput(rawInput)
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
run({
|
||||
part1: {
|
||||
tests: [
|
||||
// {
|
||||
// input: ``,
|
||||
// expected: "",
|
||||
// },
|
||||
],
|
||||
solution: part1,
|
||||
},
|
||||
part2: {
|
||||
tests: [
|
||||
// {
|
||||
// input: ``,
|
||||
// expected: "",
|
||||
// },
|
||||
],
|
||||
solution: part2,
|
||||
},
|
||||
trimTestInputs: true,
|
||||
onlyTests: false,
|
||||
})
|
31
src/utils/index.ts
Normal file
31
src/utils/index.ts
Normal file
|
@ -0,0 +1,31 @@
|
|||
/**
|
||||
* Root for your util libraries.
|
||||
*
|
||||
* You can import them in the src/template/index.ts,
|
||||
* or in the specific file.
|
||||
*
|
||||
* Note that this repo uses ES Modules, so you have to explicitly specify
|
||||
* .js extension (yes, .js not .ts - even for TypeScript files)
|
||||
* for imports that are not imported from node_modules.
|
||||
*
|
||||
* For example:
|
||||
*
|
||||
* correct:
|
||||
*
|
||||
* import _ from 'lodash'
|
||||
* import myLib from '../utils/myLib.js'
|
||||
* import { myUtil } from '../utils/index.js'
|
||||
*
|
||||
* incorrect:
|
||||
*
|
||||
* import _ from 'lodash'
|
||||
* import myLib from '../utils/myLib.ts'
|
||||
* import { myUtil } from '../utils/index.ts'
|
||||
*
|
||||
* also incorrect:
|
||||
*
|
||||
* import _ from 'lodash'
|
||||
* import myLib from '../utils/myLib'
|
||||
* import { myUtil } from '../utils'
|
||||
*
|
||||
*/
|
23
tsconfig.json
Normal file
23
tsconfig.json
Normal file
|
@ -0,0 +1,23 @@
|
|||
{
|
||||
"compilerOptions": {
|
||||
"target": "es2020",
|
||||
"module": "es2020",
|
||||
"removeComments": true,
|
||||
"declaration": true,
|
||||
"outDir": "./dist",
|
||||
"preserveConstEnums": true,
|
||||
"strict": true,
|
||||
"allowSyntheticDefaultImports": true,
|
||||
"moduleResolution": "node",
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"importHelpers": true
|
||||
},
|
||||
"include": [
|
||||
"src"
|
||||
],
|
||||
"exclude": [
|
||||
"node_modules",
|
||||
"src/**/*.test.ts",
|
||||
"src/**/*.temp.ts"
|
||||
]
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue