Skip to content

Commit b8f3fa4

Browse files
authored
docs/add crush readme (#6)
* asdY Signed-off-by: markkovari <kovarimarkofficial@gmail.com> * asdwq Signed-off-by: markkovari <kovarimarkofficial@gmail.com> * asd Signed-off-by: markkovari <kovarimarkofficial@gmail.com> * docs: add CRUSH.md Signed-off-by: markkovari <kovarimarkofficial@gmail.com> --------- Signed-off-by: markkovari <kovarimarkofficial@gmail.com>
1 parent 9e7ee5d commit b8f3fa4

2 files changed

Lines changed: 103 additions & 0 deletions

File tree

CRUSH.md

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
# Repository Overview
2+
3+
This repository contains solutions to Advent of Code problems, organized by year. Each year typically has its own directory, and within those directories, solutions may be implemented in various programming languages.
4+
5+
## Project Structure
6+
7+
- **`YYYY/`**: Directories for each Advent of Code year (e.g., `2015/`, `2022/`).
8+
- **`YYYY/<language>/`**: Within each year, there might be subdirectories for different programming languages used for solutions (e.g., `2024/golang/`, `2022/src/`).
9+
- **`YYYY/<day>/` or `YYYY/src/_<day>/`**: Individual problem solutions are often found within day-specific directories or files.
10+
- **`inputs/`**: Some years include an `inputs` directory for problem input data.
11+
12+
## Languages Used
13+
14+
The repository currently contains solutions implemented in:
15+
- Rust (e.g., `2022/`, `2021/_7/Cargo.toml`)
16+
- C# (e.g., `2021/cs/1/1.csproj`)
17+
- Go (e.g., `2024/golang/go.mod`, `2019/go/go.mod`)
18+
- TypeScript (e.g., `2021/_7/index.ts`)
19+
- Zig (e.g., `2024/zig/.gitignore`)
20+
21+
## Essential Commands
22+
23+
Due to the polyglot nature of this repository, build and test commands are specific to each language and year.
24+
25+
### Rust Projects
26+
27+
For Rust projects (identified by `Cargo.toml`):
28+
- **Build**: `cargo build`
29+
- **Run**: `cargo run`
30+
- **Test**: `cargo test`
31+
32+
Example (for 2022 solutions):
33+
```bash
34+
cd 2022
35+
cargo run --bin _1 -- input.data
36+
cargo test
37+
```
38+
39+
### Go Projects
40+
41+
For Go projects (identified by `go.mod`):
42+
- **Run**: `go run .` or `go run main.go` (if `main.go` exists)
43+
- **Test**: `go test ./...`
44+
45+
Example (for 2024 Go solutions):
46+
```bash
47+
cd 2024/golang
48+
go run .
49+
go test ./...
50+
```
51+
52+
### C# Projects
53+
54+
For C# projects (identified by `.csproj` and `.sln` files):
55+
- **Build**: `dotnet build`
56+
- **Run**: `dotnet run` (from the project directory containing the `.csproj`)
57+
- **Test**: `dotnet test`
58+
59+
Example (for 2021 C# solutions, day 1):
60+
```bash
61+
cd 2021/cs/1
62+
dotnet run
63+
```
64+
65+
### TypeScript Projects
66+
67+
TypeScript projects typically use `npm` or `yarn`. Look for `package.json` to identify scripts.
68+
- **Install dependencies**: `npm install` or `yarn install`
69+
- **Run**: `npm start` or `yarn start` (or a specific script defined in `package.json`)
70+
- **Test**: `npm test` or `yarn test`
71+
72+
Example (for 2021 _7 TypeScript solution):
73+
```bash
74+
cd 2021/_7
75+
# Assuming package.json with a start script
76+
npm install
77+
npm start
78+
```
79+
80+
## Code Organization and Patterns
81+
82+
- **Input Data**: Input files are often named `input.data` or `input.txt` and sometimes `input.example` or `input.test` for smaller test cases.
83+
- **Solution Structure**: Solutions often reside in files or directories named after the day (e.g., `_1.rs`, `_5/mod.rs`, `Program.cs`).
84+
- **Modules/Packages**: Projects generally follow standard language-specific module/package conventions.
85+
86+
## Naming Conventions and Style Patterns
87+
88+
- **File Naming**: Day-specific solutions often use `_DAY` prefix (e.g., `_1.rs`, `_5/`).
89+
- **Input Files**: `input.data`, `input.example`, `input.test`.
90+
91+
## Testing Approach and Patterns
92+
93+
- **Test Data**: Small test cases are often stored in files like `input.test` or `input.example`.
94+
- **Language-Specific Testing**: Testing follows the conventions of the respective language (e.g., `cargo test` for Rust, `go test` for Go, `dotnet test` for C#).
95+
96+
## Gotchas and Non-obvious Patterns
97+
98+
- **Polyglot Nature**: Be aware that solutions for different years, or even different days within the same year, might be implemented in entirely different languages. Always check for language-specific configuration files (`Cargo.toml`, `go.mod`, `.csproj`, `package.json`) to determine the context.
99+
- **Input Pathing**: Solutions often expect input files to be in a specific relative path, typically in an `inputs` directory or directly alongside the solution file.

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
11
Advent of Code collection
22

3+
Some content
4+
asd
35

6+
7+
asdasd

0 commit comments

Comments
 (0)