Skip to main content

A package to make CodeForces contests easier.

Project description

ecfr: Eliot's CodeForces Runner

This command line utility is meant to make it easy to download and run programs for use in CodeForces contests. It will automatically download contest problems, including sample test cases, and will compile and run code against these test cases. A fork of CodeforcesRunner.

Also includes starter files. Meant to be a "batteries included" way of doing Codeforces contests.

Installation

The package is available on PyPI. It can be installed with the following command:

pip install ecfr

Commands

This command line utility has four commands:

dc    Download contest or individual problems
init  Copy example files into the current working directory.
r     Run code against contest problems.
sp    Create an empty solution file from a starter file in the source files folder.

Each one has different arguments that can be viewed by looking at the help messages.

Usage

We will use Codeforces Contest 198 as a running example. This will demonstrate the workflow of using ecfr as a command line utility.

Initialization

The first thing we must do is create an environment config file and provide starter files for languages we would like to use. Fortunately, ecfr includes a sample config and starter files with reasonable defaults. To use them, we must simply navigate to the directory we would like to do the contest in and run

$ ecfr init

Download Sample Tests

Now that we have starter files and a basic config, we need to download the contest. We can download contest 198 using the following command.

$ ecfr dc 198

To download just problem A, we can add the -p A arguments. This creates a .xml for each problem downloaded, including the sample test cases. You may add additional test cases by following the format of the .xml files. By default, these are put into the contest_files directory.

Starting a Problem

Now that we have our problem files downloaded, we can start coding. To do this, we need to copy a starter file for our desired language and give it a descriptive name, according to the problem we will be solving. Let's say we wish to do problem A in the contest we downloaded in Python. We can create our file with the following command:

$ ecfr sp A py

This will create a file called A.py in the source_files directory (the location can be set in the config). Here, py is the file extension ecfr will look for when making a copy of the starter file. The directory for starter files can be set in the config file.

Running the Tests

Once we have our starter file and finish coding, we want to run the tests that we downloaded. To do this, we simply run the following command:

$ ecfr r A

With this command, ecfr will look in the source_files directory for files matching problem A. When a file is found, it will automatically compile and run it against all test cases in the A.xml file.

Submitting

Once all test cases pass, we wish to submit our source file. This is as easy as selecting A.py and uploading the file on the contest submission page. Make sure to select the appropriate programming language. If you are using Python 3, be sure and submit to PyPy3, as this generally runs much faster.

Configurations

The file conf.json contains the used compile and execute commands. More commands can be added for different languages. In addition, names of directories for source files, contest files, and executables can be changed.

About

This tool is only verified on Linux and is still considered in beta. Once more testing has been done and more test cases have been added, we will proceed with a full release.

Acknowledgements

Thanks to sayuan and all of the contributors to the original CodeforcesRunner project. Additional thanks to dhashe for help testing this project.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ecfr-0.1.1.tar.gz (10.7 kB view details)

Uploaded Source

Built Distribution

ecfr-0.1.1-py3-none-any.whl (10.3 kB view details)

Uploaded Python 3

File details

Details for the file ecfr-0.1.1.tar.gz.

File metadata

  • Download URL: ecfr-0.1.1.tar.gz
  • Upload date:
  • Size: 10.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.7.1 CPython/3.11.0 Linux/6.2.0-1019-azure

File hashes

Hashes for ecfr-0.1.1.tar.gz
Algorithm Hash digest
SHA256 8aa36f265bcf5578ef9cec7cacb7236f75e494f75258e5e57f8a5113c9548729
MD5 d0acd98bcbcaf80e998891b9d9168ab0
BLAKE2b-256 7cd49bed0632b9f11047186b5c57a5a0e09bbb99dfc07f310e25c7a8aa61f277

See more details on using hashes here.

File details

Details for the file ecfr-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: ecfr-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 10.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.7.1 CPython/3.11.0 Linux/6.2.0-1019-azure

File hashes

Hashes for ecfr-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 889566fe869bf1ac1c140691490cb7fd6ac89c210f8f8c7d0525dec86174588f
MD5 08e3e62362687ad9b4a2d25a6a74c50a
BLAKE2b-256 060dfa645b4d111aa33e1a9d98ad14bc283fde0060b0d6c4491de13037d0d7e1

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page