judge_system 1.3.0 → 1.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +3 -2
- data/lib/compile_systems/java_system.cpp +43 -33
- data/lib/compile_systems/py_system.cpp +28 -0
- data/lib/judge_system/version.rb +1 -1
- data/lib/judge_system.rb +1 -1
- data/wercker.yml +17 -0
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7f17bd691aafc0327392df7b6ccd019c943b18e3
|
4
|
+
data.tar.gz: 72e7aa6563ac2466f5fb379f2b611991e7a7081f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c36e4f011f51c1dbc84a11c4747d48709d83d2e78b1efdfb63f5c04a8b625227c4d750761d8343269f3053232d30bd0bd43778b169892a21b8d7b185e2ccbd86
|
7
|
+
data.tar.gz: 7f58b8f5b213d9b27c5a90bed6657e3646a0794c2c636d96e34b7e76dc5b1aeb72dd5c3ecafd99649903ab20cc6d03a6da6bfbe5f3b5e4e5895afcc8ba5c8b84
|
data/README.md
CHANGED
@@ -1,10 +1,11 @@
|
|
1
|
+
[![wercker status](https://app.wercker.com/status/0964573b38729ce98909559e3779cca5/s/master "wercker status")](https://app.wercker.com/project/byKey/0964573b38729ce98909559e3779cca5)
|
1
2
|
# JudgeSystem
|
2
3
|
|
3
4
|
Judge_system is a compile and judge system for online judge.
|
4
5
|
This system work on [melpon/wandbox](https://github.com/melpon/wandbox).
|
5
6
|
That means you don't have to concern about dangerous codes if you use judge_system.
|
6
7
|
Judge_system returns four results ('AC', 'WA', 'RE', 'TLE').
|
7
|
-
Now, it can compile c, c++, ruby, go.
|
8
|
+
Now, it can compile c, c++, ruby, go, python3.
|
8
9
|
|
9
10
|
## Installation
|
10
11
|
|
@@ -29,7 +30,7 @@ require 'judge_system'
|
|
29
30
|
|
30
31
|
JudgeSystem.judge_result lang: (string text), code: (string text), answer: (string text), stdin: (string text), time: (num sec)
|
31
32
|
|
32
|
-
#Lang is the extension of languages (example: c is 'c', c++ is 'cpp', ruby is 'rb', go is 'go').
|
33
|
+
#Lang is the extension of languages (example: c is 'c', c++ is 'cpp', ruby is 'rb', go is 'go', python3 is 'py').
|
33
34
|
#You can't use more than 1M byte code, input, answer.
|
34
35
|
|
35
36
|
```
|
@@ -8,7 +8,7 @@ int main(int argc, char const *argv[])
|
|
8
8
|
ofs.open("Main.java",ios::binary);
|
9
9
|
string buf;
|
10
10
|
while(getline(cin,buf)){
|
11
|
-
if(buf=="
|
11
|
+
if(buf=="<$><*><$>")break;
|
12
12
|
ofs<<buf<<endl;
|
13
13
|
}
|
14
14
|
ofs.close();
|
@@ -25,54 +25,64 @@ int main(int argc, char const *argv[])
|
|
25
25
|
|
26
26
|
|
27
27
|
|
28
|
-
/*
|
28
|
+
/*
|
29
|
+
import java.util.*;
|
29
30
|
import java.io.*;
|
30
31
|
class Career{
|
31
32
|
public static void main(String[] args){
|
32
33
|
|
33
|
-
|
34
|
-
File code
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
String str
|
39
|
-
BufferedReader
|
40
|
-
|
41
|
-
Runtime r
|
42
|
-
|
34
|
+
BufferedReader sc;
|
35
|
+
File code;
|
36
|
+
File stdin;
|
37
|
+
FileWriter pw1;
|
38
|
+
FileWriter pw2;
|
39
|
+
String str;
|
40
|
+
BufferedReader br1;
|
41
|
+
BufferedReader br2;
|
42
|
+
Runtime r;
|
43
|
+
Runtime rr;
|
44
|
+
InputStream compile;
|
45
|
+
InputStream run;
|
43
46
|
|
44
47
|
try{
|
45
|
-
sc = new
|
48
|
+
sc = new BufferedReader(new InputStreamReader(System.in));
|
46
49
|
code = new File("Main.java");
|
50
|
+
code.createNewFile();
|
51
|
+
code = new File("Main.java");
|
52
|
+
stdin = new File("test.in");
|
53
|
+
stdin.createNewFile();
|
47
54
|
stdin = new File("test.in");
|
48
|
-
|
49
|
-
pw2 = new
|
55
|
+
pw1 = new FileWriter(code, true);
|
56
|
+
pw2 = new FileWriter(stdin, true);
|
50
57
|
while(true){
|
51
|
-
str = sc.
|
52
|
-
if(str.equals("
|
58
|
+
str = sc.readLine();
|
59
|
+
if(str.equals("<$><*><$>")){
|
53
60
|
break;
|
54
61
|
}
|
55
|
-
|
62
|
+
pw1.write(str);
|
56
63
|
}
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
pw2.
|
64
|
+
pw1.close();
|
65
|
+
|
66
|
+
|
67
|
+
while((str = sc.readLine()) != null){
|
68
|
+
pw2.write(str);
|
62
69
|
}
|
63
|
-
|
64
|
-
|
70
|
+
pw2.close();
|
65
71
|
r = Runtime.getRuntime();
|
66
|
-
|
67
|
-
compile.
|
68
|
-
run =
|
69
|
-
|
70
|
-
|
71
|
-
while ((
|
72
|
-
System.out.println(
|
72
|
+
rr = Runtime.getRuntime();
|
73
|
+
compile = r.exec("/opt/wandbox/openjdk-head/bin/javac Main.java").getInputStream();
|
74
|
+
run = rr.exec("/opt/wandbox/openjdk-head/bin/java Main < test.in").getInputStream();
|
75
|
+
br1 = new BufferedReader(new InputStreamReader(compile));
|
76
|
+
br2 = new BufferedReader(new InputStreamReader(run));
|
77
|
+
while ((str = br1.readLine()) != null) {
|
78
|
+
System.out.println(str);
|
79
|
+
}
|
80
|
+
while ((str = br2.readLine()) != null) {
|
81
|
+
System.out.println(str);
|
73
82
|
}
|
74
83
|
}catch(Exception e ){
|
75
84
|
e.printStackTrace();
|
76
85
|
}
|
77
86
|
}
|
78
|
-
}
|
87
|
+
}
|
88
|
+
*/
|
@@ -0,0 +1,28 @@
|
|
1
|
+
#include <iostream>
|
2
|
+
#include <fstream>
|
3
|
+
using namespace std;
|
4
|
+
|
5
|
+
char command[1024];
|
6
|
+
|
7
|
+
int main(int argc, char const *argv[])
|
8
|
+
{
|
9
|
+
ofstream ofs;
|
10
|
+
ofs.open("main.py",ios::binary);
|
11
|
+
string buf;
|
12
|
+
string splitter="<$><*><$>";
|
13
|
+
string time;
|
14
|
+
while(getline(cin,buf)){
|
15
|
+
if(buf==splitter)break;
|
16
|
+
ofs<<buf<<endl;
|
17
|
+
}
|
18
|
+
ofs.close();
|
19
|
+
ofs.open("test.in",ios::binary);
|
20
|
+
while(getline(cin,buf)){
|
21
|
+
if(buf==splitter)break;
|
22
|
+
ofs<<buf<<endl;
|
23
|
+
}
|
24
|
+
ofs.close();
|
25
|
+
cin>>time;
|
26
|
+
system(("timeout -s 9 " + time + " /opt/wandbox/cpython-head/bin/python3 main.py < test.in").c_str());
|
27
|
+
return 0;
|
28
|
+
}
|
data/lib/judge_system/version.rb
CHANGED
data/lib/judge_system.rb
CHANGED
@@ -29,7 +29,7 @@ module JudgeSystem
|
|
29
29
|
sys = File.open("#{path}/compile_systems/#{lang}_system.cpp", "r").read
|
30
30
|
data = nil
|
31
31
|
spliter = "\n<$><*><$>\n"
|
32
|
-
stdin = code + spliter + input + spliter + time
|
32
|
+
stdin = code + spliter + input + spliter + ("%f" % time)
|
33
33
|
begin
|
34
34
|
data = compile( compiler: "gcc-head", code: sys, stdin: stdin )
|
35
35
|
rescue
|
data/wercker.yml
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
# http://devcenter.wercker.com/docs/services/postgresql.html
|
2
|
+
box: ruby
|
3
|
+
# - mongo
|
4
|
+
# http://devcenter.wercker.com/docs/services/mongodb.html
|
5
|
+
|
6
|
+
# This is the build pipeline. Pipelines are the core of wercker
|
7
|
+
# Read more about pipelines on our dev center
|
8
|
+
# http://devcenter.wercker.com/docs/pipelines/index.html
|
9
|
+
build:
|
10
|
+
# Steps make up the actions in your pipeline
|
11
|
+
# Read more about steps on our dev center:
|
12
|
+
# http://devcenter.wercker.com/docs/steps/index.html
|
13
|
+
steps:
|
14
|
+
- bundle-install
|
15
|
+
- script:
|
16
|
+
name: rspec
|
17
|
+
code: bundle exec rspec
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: judge_system
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- getty104
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-03-
|
11
|
+
date: 2017-03-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -75,10 +75,12 @@ files:
|
|
75
75
|
- lib/compile_systems/cpp_system.cpp
|
76
76
|
- lib/compile_systems/go_system.cpp
|
77
77
|
- lib/compile_systems/java_system.cpp
|
78
|
+
- lib/compile_systems/py_system.cpp
|
78
79
|
- lib/compile_systems/rb_system.cpp
|
79
80
|
- lib/judge_system.rb
|
80
81
|
- lib/judge_system/version.rb
|
81
82
|
- test.rb
|
83
|
+
- wercker.yml
|
82
84
|
homepage: https://github.com/getty104/judge_system
|
83
85
|
licenses:
|
84
86
|
- MIT
|