Given source code, Makefile (or build commands), input files, and answer files then judge the program locally.
Project description
Local Judge
Given source code, Makefile (or build commands), input files, and answer files then judge the program locally.
Workflow
+-------------------------------------------------------------------------------------+
| # TA (ta_judge.py): |
| +------------------------------[unzip]---------------------------+++++ |
| | # Student (judge.py): ||||| |
| | source code ---+ ||||| |
| | | [build] ||||| |
| | v ||||| |
| hidden inp. --> input ---> program ---> output ||||| |
| | [run] | ||||| |
| | v ||||| |
| hidden ans. --> answer -------------> [compare] ---> correctness, diff result ||||| |
| +-----------------------------------------|----------------------+++++ |
| ||||| [collect] |
| vvvvv |
| score table |
+-------------------------------------------------------------------------------------+
Screenshot
Installation
$ virtualenv -p python3.6 venv
$ source venv/bin/activate
$ pip install local-judge
Features
- Both
- Automatically build the source code into executable
- Automatically run the executable for each input and compare output with answer
- Customization friendly
- Able to leverage git diff tool to compare the result with the answer
- Student (
judge.py
)- Without any dependencies but standard build-in python packages
- TA (
ta_judge.py
)- Support different zip type (
.zip
,.rar
) - When error is occurred, not interrupt or exit but just log it
- Output to excel table
- Multiprocessing
- Support different zip type (
Environment (Recommended)
- Ubuntu 18.04
- python 3.6
- git 2.17.1
Examples (with DEMO)
Usage (Student)
Configuration
judge.conf
: be placed in the root of your programBuildCommand
: how to build the executableExecutable
: the name of the executableRunCommand
: how to run the executable with input and outputInputs
: input files (can use wildcard)TempOutputDir
: the temporary directory to place output filesDiffCommand
: how to find differences between output and answerDeleteTempOutput
: whether to delete the temporary output after finding the differences (true or false)AnswerDir
: the directory where contains the answer files corresponding to the input filesAnswerExtension
: the extension of the answer filesExitOrLog
: exit when any error occurred or just log the errorScoreDict
: the dictionary for the mapping of correctness and scoreTotalScore
: used if the number of tests is more thanScoreDict
Timeout
: execution timeout for each test case
Usage (TA)
Dependencies
openpyxl
,rarfile
Configuration
ta_judge.config
:- First part is
judge.conf
StudentList
: the execl file which contains student name and idStudentsZipContainer
: the directory where contains students' submit homeworksStudentsPattern
: used to match zip filesUpdateStudentPattern
: used for update score of single studentStudentsExtractDir
: the directory where contains extracted homeworksScoreOutput
: the output excel fileExtractAfresh
: true: re-extract zipped file for each judge time; false: use pre-extracted files (underStudentsExtractDir
) to judge
- First part is
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
local-judge-2.4.2.tar.gz
(12.9 kB
view hashes)