ผลต่างระหว่างรุ่นของ "An Online Programming Judge System"
Cardcaptor (คุย | มีส่วนร่วม) |
Cardcaptor (คุย | มีส่วนร่วม) |
||
แถว 40: | แถว 40: | ||
After the compile script finishes running, it must create the file <tt>compile_result</tt> in the current directory. The file is empty if the compilation is successful, and contains the compiler's error message otherwise. | After the compile script finishes running, it must create the file <tt>compile_result</tt> in the current directory. The file is empty if the compilation is successful, and contains the compiler's error message otherwise. | ||
− | If the compilation is successful, the result of the compilation should be contained in the file <tt>a.out</tt>. | + | If the compilation is successful, the result of the compilation should be contained in the file <tt>a.out</tt>, which, again, should reside the current directory. |
== Run Script == | == Run Script == |
รุ่นแก้ไขเมื่อ 09:14, 19 กันยายน 2550
This page chronicles the design of an online programming judge system. The system consists of a web interface that allows user to view problems, submit solution programs, and view reports on how the programs performed. This document also includes a specification of the grading process and how to specify programming problems.
เนื้อหา
Candidate Tools
- Ruby as glue.
- Ruby on Rails for the web interface.
Programming Problem Specification
A programming problem is specified a collection of files contained inside a directory. The structure of the director is as follow.
<problem_id>/ public_html/ --- All the files that the user can see and download via the Internet. index.html --- The problem statement. test_cases/ --- Contains all test data. all_test.cfg --- A configuration file for all the test data. <test_number>/ --- Contain files related to a particular test data. test.cfg --- A configuration file specific to this test data. <other files #1> <other files #2> . . . script/ compile --- A shell or ruby script that compiles a source code. run --- A script that runs and grade the programming solution. grade --- A script that collects information from various runs and tally the points.
Running the Scripts
It is guaranteed that when the above 4 scripts are being run, the environment variable PROBLEM_HOME will be set to the problem's directory.
Compile Script
The compile script receives one input: the language that the solution is written in. So, it can be invoked as follows:
$PROBLEM_HOME/script/compile <language>
For examples
$PROBLEM_HOME/script/compile c $PROBLEM_HOME/script/compile c++ $PROBLEM_HOME/script/compile pascal $PROBLEM_HOME/script/compile java
Before the script runs, the current directory will have the file source, the source submitted by the user.
After the compile script finishes running, it must create the file compile_result in the current directory. The file is empty if the compilation is successful, and contains the compiler's error message otherwise.
If the compilation is successful, the result of the compilation should be contained in the file a.out, which, again, should reside the current directory.
Run Script
The run script receives two inputs: the language the solution was written in and the test case number. It can be invoked as follows:
$PROBLEM_HOME/script/run <language> <test case number>
For examples,
$PROBLEM_HOME/script/run c++ 1 $PROBLEM_HOME/script/run java 10
Before the script runs, the current directory will contain the file a.out that created by the compile script.
After the run script finishes running, it should leave two files in the current directory.
- result: The file must have the following format.
points <the points gained through this test data> elapsed_time <the time used by the solution program in milliseconds>
For examples,
points 10 eclipse_time 950
- comments: Any diagnostic messages the script wishes to output. Useful for comparing differences between the correct output and the submitted program's output.
Grade Script
The grade script receives no input. It can be invoked as follows:
$PROBLEM_HOME/script/grade
Before the script runs,