Skip to content

Commit 8120d10

Browse files
authored
Update README.md
1 parent c500a7f commit 8120d10

File tree

1 file changed

+42
-32
lines changed

1 file changed

+42
-32
lines changed

README.md

Lines changed: 42 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,37 @@
11
# AdventOfCodeBase
2-
A basic C# program for Advent of Code, retrieving puzzle inputs on the go and creating instances of solutions as they are created. It runs on .NET Core 3.1 and can be built easily in Visual Studio Code or Visual Studio.
3-
4-
## Requirements
5-
* .NET Core 3.1
2+
Template project for solving Advent of Code in C#, running on .NET Core 3.1.
3+
4+
- [Features](#features)
5+
- [Getting started](#getting-started)
6+
- [Usage](#usage)
7+
- [Requirements](#requirements)
8+
- [Configuration](#configuration)
9+
- [Running the project](#running-the-project)
10+
- [Notes & Examples](#notes--examples)
11+
- [Generating Previous Year's Solution Files](#generating-previous-years-solution-files)
12+
- [Using a Solution's Constructor](#using-a-solutions-constructor)
13+
- [Contributing](#contributing)
14+
- [License](#license)
615

716
## Features
17+
* Simple configuration with `config.json`.
818
* Fetches puzzle input from adventofcode.com and stores it locally.
9-
* Dynamically outputs current date's puzzle solution, depending on configuration.
1019
* Includes various useful utilities for typical puzzle problems.
11-
* Simple configuration with config.json.
12-
13-
## Usage
14-
### Create Project
15-
Create a new project of your own from this template repository by clicking the button shown below, or through [this link](https://github.com/sindrekjr/AdventOfCodeBase/generate).
1620

17-
||
18-
|:--:|
19-
| ![usetemplate](https://user-images.githubusercontent.com/23259585/95107477-3e522300-073a-11eb-8c80-c0cd4e1b5c11.png) |
21+
## Getting started
22+
If you haven't already, use the button shown below (or [this link](https://github.com/sindrekjr/AdventOfCodeBase/generate)) to create a new repository of your own from this template.
2023

21-
### Cleanup
22-
Make any file additions/modifications you want, such as removing solution files for previous years if you've no interest in completing those. You probably do not want to remove any files outside of `AdventOfCode/Solutions/` unless you know what you're doing.
23-
24-
### Generating Previous Year's Solution Files
25-
Use the included PowerShell script `AdventOfCode/UserScripts/GenerateSolutionFiles.ps1` to generate a year's solution files following the same layout as those already included.
24+
<kbd style>![use-this-template](https://user-images.githubusercontent.com/23259585/95107477-3e522300-073a-11eb-8c80-c0cd4e1b5c11.png)</kbd>
2625

27-
Usage: `GenerateSolutionFiles.ps1 [-Year <Int>]`
26+
Feel free to make any modifications you want. However, you probably do not want to remove any files outside of `AdventOfCode/Solutions/` unless you know what you're doing.
2827

29-
If no value is provided it will generate files for the current year. The script will avoid overwriting existing files.
28+
If any solutions files that you need are not already included, see **[Generating Previous Year's Solution Files](#generating-previous-years-solution-files)**.
3029

31-
Requires PowerShell v3 or later due to the way `$PSScriptRoot` behaves. If you have Windows 8+ you should be set. Upgrades for previous versions, and installs for macOS and Linux can be found in [Microsoft's Powershell Documentation](https://docs.microsoft.com/en-us/powershell/scripting/install/installing-powershell?view=powershell-7.1)
30+
## Usage
31+
### Requirements
32+
* [.NET Core 3.1](https://dotnet.microsoft.com/download/dotnet-core/3.1)
3233

33-
### Configure
34+
### Configuration
3435
Create `config.json` with the following key/value pairs. If you run the program without adding a `config.json` file, one will be created for you without a cookie field. The program will not be able to fetch puzzle inputs from the web before a valid cookie is added to the configuration.
3536
```json
3637
{
@@ -39,23 +40,19 @@ Create `config.json` with the following key/value pairs. If you run the program
3940
"days": [0]
4041
}
4142
```
42-
#### `cookie`
43-
Note that `c0nt3nt` must be replaced with a valid cookie value that your browser stores when logging in at adventofcode.com.
4443

45-
Instructions on locating your session cookie can be found here: https://github.com/wimglenn/advent-of-code-wim/issues/1
44+
`cookie` - Note that `c0nt3nt` must be replaced with a valid cookie value that your browser stores when logging in at adventofcode.com. Instructions on locating your session cookie can be found here: https://github.com/wimglenn/advent-of-code-wim/issues/1
4645

47-
#### `year`
48-
Specifies which year you wish to output solutions for when running the project. If left unspecified will default to the current year.
46+
`year` - Specifies which year you wish to output solutions for when running the project. If left unspecified will default to the current year.
4947

50-
#### `days`
51-
Specifies which days you wish to output solutions for when running the project. The field supports list comprehension syntax and strings, meaning the following notations are valid.
48+
`days` - Specifies which days you wish to output solutions for when running the project. The field supports list comprehension syntax and strings, meaning the following notations are valid.
5249
* `"1..4, 10"` - runs day 1, 2, 3, 4, and 10.
5350
* `[1, 3, "5..9", 15]` - runs day 1, 3, 5, 6, 7, 8, 9, and 15.
5451
* `0` - runs all days
5552

5653
Will default to current day if left unspecified and an event is actively running. Otherwise will default to `0`
5754

58-
### Code
55+
### Running the project
5956
Write your code solutions to advent of code within the appropriate day classes in the Solutions folder, and run the project. From the command line you may do as follows.
6057
```
6158
> cd AdventOfCode
@@ -64,7 +61,17 @@ Write your code solutions to advent of code within the appropriate day classes i
6461
```
6562
Using `dotnet run` from the root of the repository will also work as long as you specify which project to run by adding `-p AdventOfCode`. Note that your `config.json` must be stored in the location from where you run your project.
6663

67-
#### Notes
64+
## Notes & Examples
65+
### Generating Previous Year's Solution Files
66+
Use the included PowerShell script `AdventOfCode/UserScripts/GenerateSolutionFiles.ps1` to generate a year's solution files following the same layout as those already included.
67+
68+
Usage: `GenerateSolutionFiles.ps1 [-Year <Int>]`
69+
70+
If no value is provided it will generate files for the current year. The script will avoid overwriting existing files.
71+
72+
Requires PowerShell v3 or later due to the way `$PSScriptRoot` behaves. If you have Windows 8+ you should be set. Upgrades for previous versions, and installs for macOS and Linux can be found in [Microsoft's Powershell Documentation](https://docs.microsoft.com/en-us/powershell/scripting/install/installing-powershell?view=powershell-7.1)
73+
74+
### Using a Solution's Constructor
6875
* Code may be written in the solution constructor if it will be beneficial to both parts of the problem (such as parsing the data). Example:
6976
```CSharp
7077
public Day07() : base(07, 2015, "")
@@ -93,4 +100,7 @@ protected override string SolvePartTwo()
93100
* The extension method `SplitByNewLine()` will do exactly that, example: `string[] lines = Input.SplitByNewLine()` will split your input into lines for enumeration.
94101

95102
## Contributing
96-
Sure! Fork the project, make your changes, and submit a pull request.
103+
Sure! Fork the project, make your changes, and create a pull request. Submitted issues and pull requests are quite welcome.
104+
105+
## License
106+
[MIT](https://github.com/sindrekjr/AdventOfCodeBase/blob/master/LICENSE.md)

0 commit comments

Comments
 (0)