Блог пользователя vishalagrawal

Автор vishalagrawal, 2 года назад, По-английски

Command line tools can efficiently automate monotonous and repetitive tasks (such as creating source code files, copying boilerplate code, running code on sample testcases, etc.) and make competitive programming more fun.

There already exist various choices for command line tools in the competitive programming ecosystem like cpb and cf tool. The problem with these tools is they follow the "Flat File Structure" philosophy in which your source code and testcase files are kept in the same folder to improve the speed of manipulating (creating, updating, deleting) them. This approach causes a mess making it hard to navigate between source code files. As changes in testcase are rare, saving a few seconds is manipulating them might not be worth it.

cpb sample

CPPT is a cross-platform command-line tool made specifically to address this issue. It hides all the data required to test your code inside a hidden subfolder (.cppt) so that your folder remains clean and you can focus on writing your source code instead. It also provides you with easy-to-use and fast testcase manipulation commands.

cppt sample

Some of its key features are:-

  1. Fetch testcase data from an online judge.
  2. Compile (if applicable) and run source code against predefined or randomly generated testcases.
  3. Add testcases to run your code in advance or enter the testcase interactively.
  4. Create a source code file with your saved templates.
  5. Open the source code automatically in your favorite editor.

CPPT supports the following operating systems:-​

  1. Windows (both cmd and wsl)
  2. Linux
  3. MacOS

CPPT supports the following programming languages:-​

  1. C++
  2. Java
  3. Python

To get started, make sure you have python and pip on your system and the competitive companion extension on your browser.

Use the following command to install the tool.

$ pip install cppt

After installing the tool, type the command.

$ cppt

You should see the following help text.

Usage: cppt [OPTIONS] COMMAND [ARGS]...

Options:
  -h, --help  Show this message and exit.

Commands:
  compile  compile source code
  config   get the location of config file or reset config file
  create   create a task
  fetch    retrieve testcase data from an online judge
  run      run code against testcases
  tc       commands related to testcase data
  test     brute force testing

For more info (with video demos) refer to the documentation.

PS: Thanks sarvjot for testing the tool for Windows (cmd and wsl).

Полный текст и комментарии »

  • Проголосовать: нравится
  • +58
  • Проголосовать: не нравится

Автор vishalagrawal, 3 года назад, По-английски

Problem tags could spoil a problem, so chances are you like to keep the problem tags switched off.

Even so, you would probably like to know about the problem difficulty (or rating) or sometimes have a quick look at the tags and retry a problem before moving on to the editorial.

It could be very tedious to go to your profile and change the settings to enable the tags, then after you finish your work, switch it off again.

This extension can solve both of the issues for you.


When tags are hidden


After you click on the button

Download Instructions :-

  1. Download an user script manager like Tamper Monkey.

  2. Download the script from my Github Repo.

  3. Switch off "show tags for unsolved problems".

What is the extension doing behind the scenes

Update: Marked the rating tag as spoiler(see the image below) by default, clicking on the grey box reveals the rating tag.


Marked as spoiler


After you click the grey rating box

If you already have the script installed, you can update it from the same link provided above.

PS: Thanks naman1601 for helping me in editing the blog

Полный текст и комментарии »

  • Проголосовать: нравится
  • +42
  • Проголосовать: не нравится