https://github.com/ostcar/roc-aoc-platform
Roc platform for Advent of Code
https://github.com/ostcar/roc-aoc-platform
aoc platform roc
Last synced: 5 months ago
JSON representation
Roc platform for Advent of Code
- Host: GitHub
- URL: https://github.com/ostcar/roc-aoc-platform
- Owner: ostcar
- License: mit
- Created: 2024-11-09T23:45:05.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-12-06T14:49:00.000Z (over 1 year ago)
- Last Synced: 2025-05-25T08:39:21.664Z (about 1 year ago)
- Topics: aoc, platform, roc
- Language: Zig
- Homepage:
- Size: 127 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Roc Platform for Advent of Code
This is a [Roc](https://www.roc-lang.org/)-Platform for Advent of Code.
The puzzle input file has to be next to the roc file with an `.input` extension.
Another input file can be specified by giving a file name. `-` for stdin.
The platform staticly allocates memory on startup. The default is one GiB.
Another amount can be specified with `--memory ` or `roc run dayX.roc -- --memory `.
As default, both parts are calculated. By using `--part1` or `--part2` only one
part is calculated.
For an example Repository, see: https://github.com/ostcar/aoc2024
An roc file can be look like this:
```roc
app [solution] {
pf: platform "https://github.com/ostcar/roc-aoc-platform/releases/download/v0.0.8/lhFfiil7mQXDOB6wN-jduJQImoT8qRmoiNHDB4DVF9s.tar.br",
}
examplePart1 =
"""
the example for
part 1
"""
expect
got = part1 examplePart1
expected = Ok "the example for part 1"
got == expected
part1 = \input ->
input
|> Str.replaceEach "\n" " "
|> Ok
examplePart2 =
"""
example for
part 2
"""
expect
got = part2 examplePart2
expected = Ok "2 trap rof elpmaxe"
got == expected
part2 = \input ->
input
|> Str.replaceEach "\n" " "
|> Str.toUtf8
|> List.reverse
|> Str.fromUtf8
```