I made a Test Case Parser and it can parse test cases for your problem in just one keystroke.
Update : Contest Parser was also added
Download the github repo from here : AutomateOlympicCoding.
Video Walkthrough
How to Setup :
Video Walkthrough just explains parsing test cases for a single problem. Contest Parser was added later.
- Install all the required dependencies.
- Clone the github repo
- Place the build file in Packages->User
- Place automate.py and contest.py in the same folder as your main cpp solution file
- In the latest version you don't need to rename anything, it will generate test cases with the same name as your working file
Parsing single problem :
- Open your cpp solution file ( must be in the same directory as automate and contest.py )
- Open the problem page on Chrome ( only works on chrome )
- Open sublime text and build using automate build system ( Ctrl + Shift + B)
- This plugin will create a test file with the same name as your solution file
- Now just run your solution using FastOlympicCoding
Parsing a complete contest :
- Create a template.cpp file ( must be in the same directory as automate and contest.py ) .
- This file will be copied to all solution files when parsing the contest
- Open any cpp file in the same directory ( preferably template.cpp )
- Open the contest page on Chrome ( only works on chrome )
- Open sublime text and build using automate-contest build system ( Ctrl + Shift + B)
- This plugin will create a directory with the contest ID and it will contain cpp files for all problems with template copied into them and corresponding test files will be parsed with them.
- Just open them and start solving.
- Now just run your solution using FastOlympicCoding
Dependencies :
- Install Python3.
- pip install bs4
- pip install pywinauto
You can support me on my Youtube Channel here : GGxEpsilon
Support for more platforms like CodeChef and Atcoder will be added soon.
Thanks for reading and feedback will be appreciated.
This is really awesome !!
Feature Request: Can you make such an automation where 5 or 6 cpp files are automatically generated with same name/code as the problem itself and test cases associated with each problem are linked to thpse particular cpp files. I know about such an extension but it's for VS Code. I was wondering if it would be possible for sublime text as well.
Nice suggestion. Will implement it in a few days.
Contest Parser was Added epsilon_573 (previous revision, new revision, compare).
This seems a good add on .. One little doubt here .. Does it only support codeforces or all of the other platforms too ?
Only CodeForces for know, I just made it in two days. I will soon optimize this a little and add support for other platforms if this gets a good response.
Sure bud .. I would be definately looking for this feature to be added in near future .. Also I think adding such features would also attract more public towards this plugin.
Thanks for the extension man. Waiting for multiplatform support.
It would be great if the contest parser was also available for Firefox.
Can we merge ctrl+b and ctrl+alt+b step i mean just run using fastOlympicCoding and it parse testcase or firstly building is necessary?
I don't recommend doing that because then it will parse test cases every time you build and this would make the process slow. So just parse test cases once when you start reading the problem.
I can't get this extension to run on Linux(Manjaro) and I assume that is because it is using pywinauto. epsilon_573 Can you please guide me how to modify it to work for linux as well.
You will have to use python-ldtp or some other plugin that helps you fetch chrome URL. Unfortunately I don't primarily work on Linux, so you will have to figure it out on your own. Add me on discord (Epsilon#0765) though, and I will try to aid you. Many people have been requesting me to make this for Linux.
For now I have figured out a weak work around only for test automator and not for contest automator. I used pyautogui and am literally switching windows and fetching the url using keyboard commands. It is working while sublime and browser are top two priority windows (and works with all browsers).
I will paste in the code for reference
I removed your url computing part and used this instead. Rest all is same.
epsilon_573 Just curious, to which endpoint should I send request to get test cases of all problems of a particular contest?
I am not using an API. I am scraping the web page using BeautifulSoup.
Do you have any idea on how to get it done using codeforces API? like how people are parsing test cases of a contest when it starts? Do they all do it by scraping web?
I am pretty new to these things, please help me out. I want to parse the test cases when i run a script.
I don't think there is an API for that. Here is the list https://codeforces.me/apiHelp/methods