It is a simple python script converting polygon package to DOMjudge (kattis) package.
pip install p2d
# Unzip your polygon-package to /path/to/polygon-package first
$ p2d --code A --color '#FF0000' -o /path/to/domjudge-package /path/to/polygon-package
Run this command to make a package from /path/to/polygon-package
to /path/to/domjudge-package.zip
and set code
and color
.
All available parameters are:
--code
: problem short name in DOMjudge.--color
: problem color in DOMjudge.--default
: force use the default output validator.--validator-flags
: add some flags to the output validator, only works when--default
is set.--auto
: use the default output validator if the checker is defined in config and can be replaced by the default one.--memory-limit
: override the memory limit for DOMjudge package (in MB), default is using the memory limit defined in polygon package.--output-limit
: override the output limit for DOMjudge package (in MB), default is using the default output limit in DOMjudge setting.--replace-sample
: replace the sample input and output with the one shipped with problem statement (e.g. prevent the sample output is different from the main and correct solution).
In config.json, you can change some special checker's validator's flag or add some checker configs manually.
Don't change them unless you know what you are doing.
CONFIG_PATH
TESTLIB_PATH
EXTENSION_FOR_DESC
import tempfile
from p2d import Polygon2DOMjudge
package_dir = '/path/to/polygon-package'
output_file = '/path/to/domjudge-package' # without '.zip' suffix
with tempfile.TemporaryDirectory() as temp_dir:
try:
Polygon2DOMjudge(package_dir, temp_dir, output_file).process()
except Exception as e:
# do something
pass
# install
poetry install
# build
poetry build
# run unittest
poetry run pytest
# release
./release.sh ${your version}