Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Program clarifications #342

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 19 additions & 11 deletions spec/2023-07-draft.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,9 @@ In the case that a program is a single file, it is treated as if a directory wit
The name of the program, for the purpose of referring to it within the package, is the base name of the file or the name of the directory.
There can't be two programs of the same kind with the same name.

#### Submissions
#### Languages and Compilation

##### Submissions

The language of a submission program is determined by the `language` key in `submissions.yaml` if present;
otherwise, by comparing the file extensions of the submission file(s) to those specified in the [languages table](../appendix/languages.md).
Expand All @@ -92,10 +94,7 @@ If a single language can't be determined, building fails.
For languages where there could be several entry points, the entry point specified by the `entrypoint` key in `submissions.yaml` is used if present;
otherwise, the default entry point in the [languages table](../appendix/languages.md) is used.

Each submission must be run with a working directory that contains (a copy of) the submitted files, any compiled binaries and compilation byproducts, as well as any [included files](#included-files), and nothing else.
In particular the working directory must not contain any of the [test data](#test-data) files.

#### Other Programs
##### Other Programs

Other programs (validators and visualizers) provided as a directory may include one of two POSIX-compliant shell scripts, `build` and `run`.
If at least one of these two files is included:
Expand All @@ -105,19 +104,28 @@ If at least one of these two files is included:
2. Then, the `run` file (which now exists, and is an executable binary or POSIX-compliant shell script)
will be used as the validator or visualizer program.

Scripts may assume that a C and C++ compiler are available on the system search path, aliased to `cc` and `cpp` respectively.
Scripts may assume a POSIX-compliant shell and that a Python 3 interpreter, C compiler, and C++ compiler are available on the system search path, aliased to `python3`, `cc`, and `cpp` respectively.
Contest systems may provide additional libraries or tools.
Problem packages with `build` or `run` scripts are strongly encouraged to include a `README` file in the program directory documenting any such additional dependencies.

Programs that do not include a `build` or `run` script must have one of the following forms:
- a single Python 3 file.
- a directory containing multiple Python 3 source files, two of which are `__init__.py`, (defining a module), and `__main__.py` (which will be used as the program entry point).
- a single Python 3 file;
- a directory containing multiple Python 3 source files, two of which are `__init__.py` (defining a module) and `__main__.py` (which will be used as the program entry point);
evouga marked this conversation as resolved.
Show resolved Hide resolved
- a single C or C++ source file, or a directory containing one or more such files.

The language of files is inferred from their extension as listed in the [languages table](../appendix/languages.md).

Each input validator must be run with a working directory that contains the files in the program directory of the input validator in question.
#### Working Directory

Each program must be run in a working directory with the following contents and **nothing else**:

- For input validators: the files in the program directory of the input validator in question.
- For submissions: the submitted files, any compiled binaries of the submitted files, any [included files](#included-files), and the contents of the `.files` directory of the test case being tested (if this directory exists).
- For ouput validators, output visualizers, and static validators: the submitted files, any compiled binaries of the submitted files, as well as any included files.

Each output validator, output visualizer, and static validator must be run with a working directory that contains the submitted files and any compiled binaries of the submission being validated.
(Note in particular that this working directory does **not** contain the files in the program directory of the output validator, output visualizer or static validator.)
Please note that in particular:
- the working directory for submissions **must not** contain any of the [test data](#test-data) files, except for the contents of the test case `.files` directory;
- except for input validators, the files in a program's directory are not included in the working directory.

## Problem Metadata

Expand Down