Judge Script for Moodle-uploaded Codes
You should set up some parameters before using this judge.
EXE: name of executable file made after compiling the codes
COMPILER: compile command
You may use
$EXEin the command.
VERBOSE: boolean variable to show verbose diff using
VERBOSE_DIFF_TOOLon test failure
DEST_DIR: path to extract downloaded zip from moodle (See below)
TEMP_DIR: path to save outputs of compiled codes
INPUT_DIR: path to read inputs of test-cases
SOL_DIR: path to correct solutions of test-cases
JUDGE_DIR: path to special judges (See below)
INPUT_EXT: extension of inputs of test-cases
SOL_EXT: extension of correct solutions of compiled codes
OUT_EXT: extension of outputs of compiled codes
JUDGE_EXT: extension of special judges
CODE_ADDR: address of code to judge
$2for second argument.
TIME_LIM: time limit for each test-case
VERBOSE_DIFF_TOOL: difftool to use on test failure when
DIFF_TOOL: normal difftool to judge the answers
HAS_SPECIAL_JUDGE: array of _question_name_s with special judge
For example, for default parameters, there should be a folder structure like:
. ├── data │ ├── 0 │ │ ├── 1.in │ │ ├── 1.sol │ │ ├── 2.in │ │ ├── 2.sol │ ├── 1 │ │ ├── 01.in │ │ ├── 01.sol │ ├── 1.judge ├── judge.sh └── temp
It's possible to use custom special judge instead of simple diff to judge the codes; e.g. in situations which there is many correct solutions.
Special judge should be an executable file which can be run like:
./judge <output_file> <solution_file>
It should return (not print)
0 on Accept and
1 or any more-than-zero exit code on Wrong Answer. It should has got
$JUDGE_EXT extension and should be on path
Remember that in this case, solution_file can be any file, not necessarily a correct answer.
Remember to add question_name to
HAS_SPECIAL_JUDGE to use special judge instead of
- show help
./judge.sh -h ./judge.sh --help
- unzip the file which is downloaded by Download all submissions button from Moodle Assignment
./judge.sh -u <codes_archive_addr> ./judge.sh --unzip <codes_archive_addr>
- judge the code
./judge.sh <question_name> <code_file>
Please see contribution guide to contribute to this project.