0.0
Repository is archived
No commit activity in last 3 years
No release in over 3 years
Ruby binding for ljudge, a backend tool for an online judge system
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies

Development

~> 1.7
~> 10.0
 Project Readme

ljudge-ruby

Gem Version Code Climate Build Status

Ruby binding for ljudge

Installation

First, install ljudge along with lrun referring to ljudge project page.

If you use bundler, add this line to your application's Gemfile:

gem 'ljudge'

And then execute:

$ bundle

Or install it yourself as:

$ gem install ljudge

Usage

require 'ljudge'

args = {
  user_code: '/tmp/a.c',
  checker_code: '/tmp/checker.rb',
  testcase: [
    { input: '/tmp/1.in', output: '/tmp/1.out' },
    { input: '/tmp/2.in', output: '/tmp/2.out' }
  ]
}

options = {
  max_cpu_time: 1,
  max_memory: 2**27,
  max_compiler_cpu_time: 10
}

Ljudge.run(args, options)
#=> {"checkerCompilation"=>{"log"=>"", "success"=>true}, "compilation"=>{"log"=>"", "success"=>true}, "testcases"=>[{"memory"=>131072, "result"=>"ACCEPTED", "time"=>0.001}, {"memory"=>221184, "result"=>"WRONG_ANSWER", "time"=>0.001}]}