Skip to content

ostcar/roc-aoc-platform

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

44 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Roc Platform for Advent of Code

This is a Roc-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 <BYTES> or roc run dayX.roc -- --memory <BYTES>.

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:

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

About

Roc platform for Advent of Code

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages