Skip to content

Commit

Permalink
Add problem spec README
Browse files Browse the repository at this point in the history
  • Loading branch information
diamondburned committed Mar 12, 2024
1 parent f15615b commit 47adf62
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions problems/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Problem Generation

This directory contains problem generators, which is in charge of generating
problem inputs and their solutions. The de facto language for problem
generators is Python.

For an example of a problem generator, see [./01/problem.py](./01/problem.py).

## Specification

The server expects a problem generator to implement the following usages:

- `$PROGRAM --seed $SEED`: generate a problem input using the given seed.
- `$PROGRAM --seed $SEED --part1`: generate the part 1 solution using the given seed.
- `$PROGRAM --seed $SEED --part2`: generate the part 2 solution using the given seed.

Currently, only Python is supported as the language for problem generators.
It would be trivial to support other languages, but it is not a priority at the
moment.

## Python

Python problem generators must have a module path of `problems.NAME.problem`.
For example, if the problem name is `01`, the module path must be
`problems.01.problem`.

To test this, simply run the following command:

```sh
python -m problems.01.problem --seed 0
```

0 comments on commit 47adf62

Please sign in to comment.