Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/artberri/aoc-2023-ts-playground
Advent of Code 2023 TypeScript Playground
https://github.com/artberri/aoc-2023-ts-playground
advent-of-code advent-of-code-2023 advent-of-code-2023-typescript playground typescript
Last synced: 22 days ago
JSON representation
Advent of Code 2023 TypeScript Playground
- Host: GitHub
- URL: https://github.com/artberri/aoc-2023-ts-playground
- Owner: artberri
- License: mit
- Created: 2023-12-03T00:32:36.000Z (11 months ago)
- Default Branch: main
- Last Pushed: 2023-12-20T18:19:48.000Z (11 months ago)
- Last Synced: 2024-06-12T02:57:27.668Z (5 months ago)
- Topics: advent-of-code, advent-of-code-2023, advent-of-code-2023-typescript, playground, typescript
- Language: TypeScript
- Homepage: https://adventofcode.com/2023
- Size: 85 KB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Advent of Code 2023 TypeScript Playground
This is a Typescript playground for the [Advent of Code 2023](https://adventofcode.com/2023).
The idea of this repository is to provide an easy to play environment and allow you to focus on solving the challenges of Advent of Code 2023. It includes:
- A puzzle runner. Simply run the puzzle with the given input to get the answer.
- Test cases for the puzzles
> I'll add them as I finish them. If you want to start a puzzle before I do read the "What can I do if there is no test for the puzzle I'm trying to solve?" section.My solutions live in the branch `solutions` of this repository.
## Requirements
Node.js v20 and PNPM v8.
## Project Setup
1. Clone the repository
2. Run `pnpm install` to install dependencies## Solve a puzzle
Each Advent of Code 2023 puzzle has two parts. For example, imagine that you want to solve the puzzle of the day2.
There is a file `src/day2/part1.ts` with the following code:
```ts
// src/day2/part1.ts
export default (input: string): string => {
throw new Error("Not implemented");
};
```Run the test and see it fail:
```bash
pnpm test:part1 day2
```Implement the solution for part 1, if it is good, you should pass the test.
Run the puzzle using the input provided by the web:
```bash
pnpm start --day 2 --part 1 # You can also just run `pnpm start' and it will prompt for day and part.
```Once you solve the first part you can start with the second one. It is mostly the same.
Edit the file `src/day2/part2.ts`, it is probably worth starting by copying the code from the part 1:
Run the tests and see it fail for the part 2:
```bash
pnpm test day2
```Implement the solution for part 2, if it is good, you should pass the tests.
Run the puzzle using the input provided by the web:
```bash
pnpm start --day 2 --part 2 # You can also just run `pnpm start' and it will prompt for day and part.
```## What can I do if there is no test for the puzzle I'm trying to solve?
If there's no test for the puzzle you're trying to solve, it's because you want to start a puzzle before I do, which is probably because I'm not a regular player.
1. Create the day structure yourself by copying the example provided:
```bash
cp -R example src/dayX
```
2. Rename the test file and replace the placeholders in the file with the inputs and expected outputs of that day's puzzle.
3. Enjoy the puzzle.## Contributing
Pull requests are welcome. If you get to the next puzzle before me and prepare the tests I will be happy to merge your PR.
## License
[MIT](LICENSE)