GitHub Release : BatchTest for CodeForces - V.1.0
By Asim Krishna Prasad
Posted on 16/02/15
Tag :
Github
After working whole night on fixing bugs and everything, finally the V.1.0 of CodeForces Batch-Test is ready. Tried a lot to download the problems but the Unicode Error persisted. Also tried a lot to ignore the spaces and extra newlines while matching the output-files but it won't work until an external program does that, and this makes the whole process slower. So, in V.1.0 the user will just get to see the output of his program and the correct output, there won't be any verdict. The project is still open and will try to add some more features is near future.
At this point I feel the need to write down the reason this project is made. It was started by me as a personal tool, to help me with my CodeForces rounds. I have a comparatively slower internet connection and running the test cases manually is a curse for a noob programmer like me. I have tested this tool in actual contest and it didn't disappoint me. I am sharing this project here so that it helps someone who faces the same problem.
Here is the link to the GitHub release
Here is the direct download link
Here is the ReadMe file of the CodeForces BatchTest - V.1.0
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
- 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
- Open a cmd window.
- Run "subl" in the cmd.
- If Sublime opens up, everything is perfect
- A default browser
- Working g++
- To check g++ is working
- Open a cmd window.
- Run "g++" in the cmd.
- If it throws an error of missing file, everything is perfect
Installation
- Download all the files from here.
- Shift the CF folder to "C:\". This is very important for the application to work. The CF folder should be directly in C: drive
- Open Sublime-Text-3 (referred as Sublime here after), and change your build system
- GoTo "Tools -> Build System -> New Build System".
- A file with some pre-written code will open, delete all the contents of this file.
- 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.
- Save this file in the default location with name CF
- GoTo "Tools -> Build System" and select CF
- Your Sublime is now configured
- 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
If you are interested in how all this works, you should have a look on these posts:
Hope it helps :)
Asim Krishna Prasad
COMMENTS :