Project

clicoder

0.0
No commit activity in last 3 years
No release in over 3 years
Make it easy to deal with online programming contests from the command line
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 0
~> 1.3
>= 0
>= 0
>= 0

Runtime

~> 2.4.2
~> 2.7.3
~> 1.6.2.1
~> 0.19.1
 Project Readme

CLI Coder

Command Line Interface for Online Programming Contests.

Gem Version wercker status Coverage Status Code Climate Dependency Status Inline docs

Why

Programming contests are fun. However, there are chores which are not fun, like

  • copy a sample input and run a program against it
  • compare it with a sample answer
  • submit (copy & paste or select a file)

This tool automate these chores so that we can enjoy only really fun part of programming contests (which is, thinking and implementing).

Demo Video

Here is a demo solving a problem from AOJ (links to youtube):

CLI Coder demo

Installation

$ gem install clicoder

Preparation

~/.clicoder.d/config.yml (required)

It contains

  • configurations of template files
  • configurations for various programming contest sites.

Example:

---
sites:
  default:
      template: template.cpp # template file. relative to this file
  aoj:
      template: aoj_template.cpp # template only used for site 'aoj'
      user_id: Glen_S
      password: PASSWORD
  atcoder:
      user_id: Glen_S
      password: PASSWORD

template.cpp etc. (recommended)

It is recommended to put your template file under ~/.clicoder.d. It will be copied into working directories as main.* each time you start solving new problems.

If you don't use templates, make sure you write your solutions in files named main.*.

Usage

Commands:
  clicoder add_test        # Add new test case
  clicoder all             # build, execute, and judge
  clicoder browse          # Open problem page with the browser
  clicoder build           # Build your program
  clicoder download        # Download description, inputs and outputs
  clicoder execute         # Execute your program
  clicoder help [COMMAND]  # Describe available commands or one specific command
  clicoder judge           # Judge your outputs
  clicoder new <command>   # start a new problem
  clicoder submit          # Submit your program

Sites Available

clicoder new aoj PROBLEM_NUMBER # Prepare directory to deal with new problem from AOJ
clicoder new atcoder TASK_URL   # Prepare directory to deal with new problem from AtCoder

AOJ

PROBLEM_NUMBER is shown in problem URL like this:

http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0001

AtCoder

TASK_URL is a URL which looks like this:

http://arc001.contest.atcoder.jp/tasks/arc001_1

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

Testing

This repository uses RSpec to test application logic and Cucumber to test acceptance as a CLI tool. Make sure both tests passes before submitting pull requests.

$ bundle exec rspec spec/
$ bundle exec cucumber features/

Add a Site

It's easy to add new sites.

  1. Implement new site class
  2. Add it to the factory method (new_with_config) in lib/clicoder/site_base.rb
  3. Add new command (clicoder new new_site ARGS) in lib/clicoder/cli.rb

Site classes resides in lib/clicoder/sites directory. See existing sites for examples.

You need to implement abstract methods specified in Clicoder::SiteBase.

And you need to specify xpaths for description, sample inputs, and sample outputs for a problem of the site you created. You can specify multiple xpaths for sample inputs and sample outputs (those are joined with | operator of xpath). Write it in config/default.yml, under xpaths: section like this:

languages:
  ...
xpaths:
  ...
  YOUR_SITE:
    description: YOUR_DESCRIPTION_XPATH
    inputs:
      - YOUR_SAMPLE_INPUTS_XPATH
      - YOUR_SAMPLE_INPUTS_XPATH_2
    outputs:
      - YOUR_SAMPLE_OUTPUTS_XPATH
      - YOUR_SAMPLE_OUTPUTS_XPATH_2