Skip to content

Commit 5543b6c

Browse files
authored
Merge pull request #551 from adpi2/2024-setup
Prepare Solutions for 2024
2 parents 5128b52 + bbddd81 commit 5543b6c

File tree

3 files changed

+85
-16
lines changed

3 files changed

+85
-16
lines changed

2023/README.md

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
# Scala Advent of Code 2023
2+
3+
Solutions in Scala for the annual [Advent of Code](https://adventofcode.com/) challenge. _Note: this repo is not affiliated with Advent of Code._
4+
5+
> See earlier editions:
6+
> - [2021](/2021/README.md)
7+
> - [2022](/2022/README.md)
8+
9+
## Website
10+
11+
The [Scala Advent of Code](https://scalacenter.github.io/scala-advent-of-code/) website contains:
12+
- some explanation of our solutions to [Advent of Code (adventofcode.com)](https://adventofcode.com/)
13+
- more solutions from the community
14+
15+
## Setup
16+
17+
We use Visual Studio Code with Metals to write Scala code, and scala-cli to compile and run it.
18+
19+
You can follow these [steps](https://scalacenter.github.io/scala-advent-of-code/setup) to set up your environement.
20+
21+
### How to open in Visual Studio Code
22+
23+
After you clone the repository, open a terminal and run:
24+
```
25+
$ cd scala-advent-of-code
26+
$ scala-cli setup-ide 2023
27+
$ mkdir 2023/input
28+
$ code 2023
29+
```
30+
31+
`code 2023` will open Visual Studio Code and start Metals. If not you may have to go to the Metals pane and click
32+
the button labelled "Start Metals".
33+
34+
When you navigate to a file, e.g. `2023/src/day01.scala` metals should index the project, and then display code lenses
35+
above each of the main methods `part1` and `part2`, as shown in this image:
36+
![](img/code-lenses.png)
37+
38+
To run a solution, first copy your input to the folder `2023/input`.
39+
Then click `run` in VS Code which will run the code and display the results of the program. Or `debug`,
40+
which will let you pause on breakpoints, and execute expressions in the debug console.
41+
42+
### How to run a solution with command line
43+
44+
In a terminal you can run:
45+
```
46+
$ scala-cli 2023 -M day01.part1
47+
Compiling project (Scala 3.x.y, JVM)
48+
Compiled project (Scala 3.x.y, JVM)
49+
The solution is 64929
50+
```
51+
52+
Or, to run another solution:
53+
```
54+
$ scala-cli 2023 -M <dayX>.<partX>
55+
```
56+
57+
By default the solution programs run on our input files which are stored in the `2023/input` folder.
58+
To get your solutions you can change the content of those files in the `2023/input` folder.
59+
60+
## Contributing
61+
- Please do not commit your puzzle inputs, we can not accept them as they are protected by copyright

2024/project.scala

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
//> using scala 3.5.2
2+
//> using option -Wunused:all
3+
//> using test.dep org.scalameta::munit::1.0.2

README.md

Lines changed: 21 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,20 @@
11
# Scala Advent of Code 2023
22

3-
Solutions in Scala for the annual [Advent of Code](https://adventofcode.com/) challenge. _Note: this repo is not affiliated with Advent of Code._
3+
Solutions in Scala for the annual [Advent of Code (adventofcode.com)](https://adventofcode.com/) challenge.
44

5-
> See earlier editions:
6-
> - [2021](/2021/README.md)
7-
> - [2022](/2022/README.md)
5+
_Note: this repo is not affiliated with Advent of Code._
6+
7+
See earlier editions:
8+
9+
- [2021](/2021/README.md)
10+
- [2022](/2022/README.md)
11+
- [2023](/2023/README.md)
812

913
## Website
1014

1115
The [Scala Advent of Code](https://scalacenter.github.io/scala-advent-of-code/) website contains:
12-
- some explanation of our solutions to [Advent of Code (adventofcode.com)](https://adventofcode.com/)
16+
17+
- some explanation of our solutions to [Advent of Code](https://adventofcode.com/)
1318
- more solutions from the community
1419

1520
## Setup
@@ -23,39 +28,39 @@ You can follow these [steps](https://scalacenter.github.io/scala-advent-of-code/
2328
After you clone the repository, open a terminal and run:
2429
```
2530
$ cd scala-advent-of-code
26-
$ scala-cli setup-ide 2023
27-
$ mkdir 2023/input
28-
$ code 2023
31+
$ scala-cli setup-ide 2024
32+
$ mkdir 2024/input
33+
$ code 2024
2934
```
3035

31-
`code 2023` will open Visual Studio Code and start Metals. If not you may have to go to the Metals pane and click
36+
`code 2024` will open Visual Studio Code and start Metals. If not you may have to go to the Metals pane and click
3237
the button labelled "Start Metals".
3338

34-
When you navigate to a file, e.g. `2023/src/day01.scala` metals should index the project, and then display code lenses
39+
When you navigate to a file, e.g. `2024/src/day01.scala` metals should index the project, and then display code lenses
3540
above each of the main methods `part1` and `part2`, as shown in this image:
3641
![](img/code-lenses.png)
3742

38-
To run a solution, first copy your input to the folder `2023/input`.
43+
To run a solution, first copy your input to the folder `2024/input`.
3944
Then click `run` in VS Code which will run the code and display the results of the program. Or `debug`,
4045
which will let you pause on breakpoints, and execute expressions in the debug console.
4146

4247
### How to run a solution with command line
4348

49+
To run a solution, first copy your input to the folder `2024/input`.
50+
4451
In a terminal you can run:
4552
```
46-
$ scala-cli 2023 -M day01.part1
53+
$ scala-cli 2024 -M day01.part1
4754
Compiling project (Scala 3.x.y, JVM)
4855
Compiled project (Scala 3.x.y, JVM)
4956
The solution is 64929
5057
```
5158

5259
Or, to run another solution:
5360
```
54-
$ scala-cli 2023 -M <dayX>.<partX>
61+
$ scala-cli 2024 -M <dayX>.<partX>
5562
```
5663

57-
By default the solution programs run on our input files which are stored in the `2023/input` folder.
58-
To get your solutions you can change the content of those files in the `2023/input` folder.
59-
6064
## Contributing
65+
6166
- Please do not commit your puzzle inputs, we can not accept them as they are protected by copyright

0 commit comments

Comments
 (0)