Moj Instructions

Embed Size (px)

Citation preview

  • 8/11/2019 Moj Instructions

    1/2

    moj 4.15========

    Hello!

    moj is a plug-in for the TopCoder arena that helps you competelocally. When you open a problem, moj pulls the example test casesfrom the problem statement and adds test code to your sourcefile. When you run your solution locally, it will be run on theexamples. The test code will be stripped when you submit your solutionin the Arena.

    moj supports C++ and Java.

    moj extends the functionality of TZTester. It requires CodeProcessor(v2.0 recommended) and FileEdit, both of which are bundled withmoj. Improvements over TZTester are:

    1. Output is prettier. Numbers are no longer surrounded by quotes. A small summary is output after the results for individual cases. If this summary does not appear, your program crashed while solving one of the cases.

    2a. Doubles and arrays of doubles are compared correctly (with an

    absolute and relative tolerance of 1e-9).

    2b. If the result is a double or array of doubles and your output is not exact, moj will display the relative error of your output. For example:

    Test Case #0... PASSED (relative error 5.44969e-014) Test Case #1... PASSED (relative error 5.68462e-012) Test Case #2... PASSED (relative error 4.05691e-008) Test Case #3... PASSED All 4 tests passed!

    The purpose of this feature is to alert you when your solution may

    be insufficiently precise. Test case 2 passes because the absolute error is small enough. However, it is a good indicator that your solution is not precise enough for systests. Indeed, modifying the code to use 80-bit floating-point variables changes the report to:

    Test Case #0... PASSED (relative error 2.88899e-015) Test Case #1... PASSED (relative error 3.82932e-015) Test Case #2... PASSED (relative error 4.63219e-012) Test Case #3... PASSED All 4 tests passed!

    3. Restructured test harness. Adding custom cases is much easier. Placeholders are in place at the bottom of the test code, just

    scroll down and uncomment one of them. You may also add additional cases.

    4. Java support. Through a hack (language auto-detection from source code, based on heuristics) you may switch between Java and C++ after opening a problem.

    5. Timing per test case.

    6. Visual C++ support.

  • 8/11/2019 Moj Instructions

    2/2

    Setup:

    1. Unzip the three .jar files in the moj package to a folder of yourliking.

    2. Launch the Arena. Open the "Options" menu and select "Editors".

    3. Add CodeProcessor, with entry point codeprocessor.EntryPoint. Add codeprocessor.jar, moj.jar and fileedit.jar to the classpath.

    4. In the "Editor preferences" window, select CodeProcessor then "Configure". Under "Editor EntryPoint" write fileedit.EntryPoint. Configure FileEdit.

    I recommend checking off "Backup existing file then overwrite".

    Included in the moj package are minimal code templates for C++ and Java.

    5. In the CodeProcessor configuration window, write moj.moj as the processor class and verify. If all is good, you'll get 4 "found" reports. Configure moj to your liking.

    For bug reports, suggestions and questions, please use the membercontact feature at the TopCoder website or the forum thread. My handleis lovro.