An open API service indexing awesome lists of open source software.

https://github.com/maple3142/simple-judger


https://github.com/maple3142/simple-judger

judge node-module nodejs onlinejudge sandbox

Last synced: 16 days ago
JSON representation

Awesome Lists containing this project

README

          

Simple Judger
================
A simple npm module to judge C/C++ program.(Linux only)
using [EasySandbox](https://github.com/daveho/EasySandbox) for safety judge

**[jsdoc link](https://maple3142.github.io/docs/simple-judger/)**

Install:
----------------
sudo? `npm install simple-judger`

Usage:
----------------
```javascript
var judge=require('simple-judger');
var options={
src: `#include
using namespace std;
......`, //code !REQUIRED!
in: '', //input string
out: '', //output string
timelimit: 1000, //ms !REQUIRED!
compile: 'g++ -o {out} {dest}', //compile command, {source} {out} will be replaced !REQUIRED!
result: { //result strings, these are default value
Accepted: 'AC',
Runtime_Error: 'RE',
Time_Limit_Exceeded: 'TLE',
Compile_Error: 'CE',
Wrong_Answer: 'WA',
System_Error: 'SE'
}
};
judge(options).then(result=>{
console.log(result);
});
```
Result Object:
----------------
```javascript
{
result: 'AC',
time: 10,
extra: 'Hello World'
//extra in different result represent different result
}
```

run `npm test` for testing

Installation Error:
----------------
if "permission denied" appear, add `sudo` then install again

others error please create a `Issue` on github