Skip to content
Judge Script for Moodle-uploaded Codes - mirror of
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

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 $EXE in the command.
  • VERBOSE: boolean variable to show verbose diff using VERBOSE_DIFF_TOOL on 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
    Default is $2 for second argument.
  • TIME_LIM: time limit for each test-case
  • VERBOSE_DIFF_TOOL: difftool to use on test failure when VERBOSE is true
  • 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.sol
│   │   ├──
│   │   ├── 2.sol
│   ├── 1
│   │   ├──
│   │   ├── 01.sol
│   ├── 1.judge
└── temp

Special Judge

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 $JUDGE_DIR.
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 $DIFF_TOOL.


  • show help
./ -h
./ --help
  • unzip the file which is downloaded by Download all submissions button from Moodle Assignment
./ -u <codes_archive_addr>
./ --unzip <codes_archive_addr>
  • judge the code
./ <question_name> <code_file>


Please see contribution guide to contribute to this project.

You can’t perform that action at this time.