@pakhandi pakhandi released this Feb 16, 2015 · 29 commits to master since this release

Assets 2

Batch-Test for CodeForces : V.1.0

This application is to assist a competitive-programmer in a CodeForces round. This application downloads all the sample test cases for a problem and runs a user's solution program on all these test cases so that no time is wasted on manual checking of the solution.

For now the application is for C++ users only.

Requisites

  • Windows OS
  • Internet Connection (it should be working on cmd and should be allowed for all the applications)
  • A little space in C: drive
  • Sublime Text-3 (make sure it's included in the PATH-variables)
    • To check Sublime Text-3 is included to PATH-variables
      1. Open a cmd window.
      2. Run "subl" in the cmd.
      3. If Sublime opens up, everything is perfect
  • A default browser
  • Working g++
    • To check g++ is working
      1. Open a cmd window.
      2. Run "g++" in the cmd.
      3. If it throws an error of missing file, everything is perfect

Installation

  1. Download all the files from here.
  2. Shift the CF folder to "C:\". This is very important for the application to work. The CF folder should be directly in C: drive
  3. Open Sublime-Text-3 (referred as Sublime here after), and change your build system
    1. GoTo "Tools -> Build System -> New Build System".
    2. A file with some pre-written code will open, delete all the contents of this file.
    3. In the src folder you'll find a file CF.sublime-build. Copy the contents of this file in the file that had opened up in the previous step.
    4. Save this file in the default location with name CF
    5. GoTo "Tools -> Build System" and select CF
    6. Your Sublime is now configured
  4. Change the template code in template.cpp as it suits you.

Technology Used

  • The application is made using Python-2.7.9 and Shell scripting
  • BeautifulSoup module is used alongwith requests in Python

Testing

The program has been tested on Windows-8.1, 64-bit

Usage

Just click on the start.bat file in the C:/CF/dist/ folder and it'll open a cmd window in which you'll need to enter the CodeForces round number (the one you see in the URL).

It'll then download everything and open Sublime and the problemset in our default browser.

Code your solution and press Ctrl+B to compile the code.

Use Ctrl+Shift+B to run the program on the test files.



NOTE:
It's better to have a shortcut of the start.bat file on Desktop or somewhere more accessible.

Understanding Source Files

  • start.bat
    It is the batch file which drives the entire application. It first takes the round number as the input and passes it to the ini.exe. After ini.exe has completed it's task, start.bat opens the contest-folder in Sublime, and opens the template for the first problem, after that it opens the Problems-Webpage in the default browser and ends.
  • ini.exe
    ini.exe is the executable format of the python script ini.py. The python script ini.py uses requests and BeautifulSoup to fetch the data from the CodeForces site. The driver batch file, start.bat, passes the round number to the python script so that the script fetches the problems of the required round. ini.exe also makes the folders, according to the question numbers, and puts the test-cases as well as the template code into them. Another bat file, f.bat is also transferred to all the folders.
  • f.bat
    This batch file holds the responsibility to run the .exe file generated by the program of the user on all the test-files and show the output generated by the user's program and the correct output, in a cmd-window.
  • template.cpp
    This file is to allow user to set a template code for his solutions. This code will be transferred to each problem-folder as prog.cpp
  • CF.sublime-build
    This is the sublime-build file. This is a custom build which compiles cpp code and makes an exe file on Ctrl+B, and runs the f.bat file on Ctrl+Shift+B.

Refer to this post for more detailed explanation of the working of the application.

For Hugs and Bugs drop a mail at asimkprasad@gmail.com