The missing topcoder arena plugin for algorithm contest.
Go to Releases page.
Go to [Downloads], and download the single Greed jar. The binary is compatible with Java 1.6+.
Open Topcoder arena -> Login -> Options -> Editor -> Add
Done! Remember to check Default and At startup.
Click Configure.
Fill in your workspace full path, make sure it's a existing directory.
All set! Go get your rating!
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,
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.
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
.
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]
.
filetest
template uses filetest templates, which depends on testcase
template. It reads data from the testcase
output, and test your program with them. Bind to a piece of code in the source
template.source
template generates class and method signature from the problem definitiontestcase
template outputs test data file to ${Problem.Name}.sample
.--
problem-desc
template generates the problem statement into a web page.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
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]
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.
overwrite
behaviour (force, backup or skip)outputKey
or outputFile
, using variables like ${Problem.Name}
, ${Contest.Name}
templateFile
to your template (relative path to your workspace)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.
Go to wiki.
You'll learn how to config all the functionalities, like
${Problem.Score}
begin cut
and end cut
format and other language specific configurationsThe 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'.
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.
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!
Any help is helpful and greatly appreciated.
You can contribute in 2 ways:
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.