zen0wu / topcoder-greed

greedy editor for topcoder arena
Apache License 2.0
229 stars 45 forks source link

Greed

The missing topcoder arena plugin for algorithm contest.

Greed is good

Downloads

Go to Releases page.

Quick start

  1. Go to [Downloads], and download the single Greed jar. The binary is compatible with Java 1.6+.

  2. Open Topcoder arena -> Login -> Options -> Editor -> Add
    Add greed
    Done! Remember to check Default and At startup.

  3. Click Configure.
    Configure greed
    Fill in your workspace full path, make sure it's a existing directory.

  4. All set! Go get your rating! Greed UI

Go rock with config

Everything in greed is configuable.

Greed is bundled with some default config, which should be enough for most of you. But if you're not satisfied, go set.

Start with creating a file called greed.conf under your workspace root.

Things you can do with this config,

greed.codeRoot

Change where your code is stored, via greed.codeRoot = ???, this path is relative to your workspace root. Default set to ${Contest.Name}, which means a folder with the name of the current contest under your workspace root.

greed.language.\<lang>

This is the configuration object for a specific language, including its template definitions, template to use when submitting, and other language specific settings.

Available language keys are cpp, java, csharp, and python.

Templates sequence

The key is greed.language.<lang>.templates. This is the templates generated by Greed, and any dependent templates will also be generated first (Yup, you're right, by topological order).

The default templates for each language are [filetest, source, problem-desc].

Unit test

Another official template is unittest, but disabled by default. This kind of template generates unit test code leveraging UT framework like junit for Java, nunit for C#, and unittest for Python. To use it, set as the following (available for Java, C#, and Python):

greed.language.<lang>.templates = [source, unittest, problem-desc]

This idea was orignally proposed by @tomtung. You can use the unittest code in your favorite IDE, like the following

Resharper NUnit Debugging

Legacy test

Older versions of Greed write test code and test data into code, which makes the generated code a bit messy. However, it's left for backward compatibility and users who actually like it.

greed.language.<lang>.templates = [test, source, problem-desc]

Template definition

Magic here!

You can define your own template type, using the templateDef key under greed.language.<lang>.

Here's what you're going to do.

You can also add afterFileGen actions to execute scripts or programs after the template generation. Extreme flexibility is given. Here's an possible example of some awesome template def.

greed.language.cpp.templateDef {
    awesome {
        overwrite = skip
        outputFile = "${Contest.Name}/${Problem.Name}.cool"
        templateFile = my-awesome-template.tmpl
        afterFileGen {
            execute = /usr/bin/python
            arguments = [ scripts/awesome-script.py, "${GeneratedFileName}", "${Contest.Name}/somewhere" ]
            timeout = 5
        }
    }
}

Remember to add your template key (awesome in this example) to the templates sequence for this language, or at least make another template in the sequence depends on it.

Want to learn more?

Go to wiki.

You'll learn how to config all the functionalities, like

Build Instructions

The Greed plugin uses gradle as a build system. If you want to build the plugin from the source, invoke the command

./gradlew build     # in *NIX
gradlew.bat build   # or, in windows

to compile, test, and build a JAR archive (including dependencies) that can run in the arena. The produced JAR is located at the directory 'build/libs'.

Bug Tracker

When you encounter a bug and want to see detailed log, add the following to your greed.conf.

greed.logging.logLevel = DEBUG

You can also see the logs by opening the javaws console when launching the arena. Usually this can be enabled in the system-wide java control panel.

Java Web Start Console Setting

For bugs and new features, raise issues here. Please, with the detailed logs, and the problem you're solving and the room you're in, to better identify the problem.

Or, consider contribution!

Contribute to me

Any help is helpful and greatly appreciated.

You can contribute in 2 ways:

  1. Fork, code, and send a pull request. Oh, you're not familiar with this style, well, you should. Read this article.
  2. Be a collaborator, contact @shivawu

License

Copyright 2012-2013 Greed

Licensed under Apache License, Version 2.0. You may obtain a copy of the license in the LICENSE file, or at:

[http://www.apache.org/licenses/LICENSE-2.0]()

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.