Giter Site home page Giter Site logo

komodo-rs's Introduction

Komodo - Simplifying competitive programming for the Rust language

license

Tired of having to copy-paste your library code into every solution you write? Komodo is a command-line tool that allows you to easily create, expand, run and test Rust solutions for competitive programming problems.

This project is more of a template than an actual library. It provides useful CLI tools for competitive programming, but you will have to write your own code and library for the problems you want to solve.

There are some example solutions and libraries in this repository, but they are mostly for reference and testing purposes, so you should probably delete them and write your own.

Installation

Make sure you have Rust installed. Then, clone this repository (or simply create your own repository from this template):

git clone https://github.com/viniciusth/komodo-rs.git

And then you should be able to run the CLI with:

cd komodo-rs
cargo run

Usage

Komodo CLI for Rust Competitive Programming

Usage: cargo run <COMMAND>

Commands:
  expand  Expands a solution file into a submission file, saves to clipboard by default
  code    Runs main of src/code/{question}.rs
  stress  Stress tests a solution with a brute force solution
  help    Print this message or the help of the given subcommand(s)

Options:
  -h, --help     Print help
  -V, --version  Print version

Solution files and library

The project starts out with 3 solution files, but it can be easily extended by adding more questions to the questions! macro call in src/code/mod.rs and creating the corresponding .rs file following the same template as src/code/template.rs.

You can use Rust normally in your solution and library files, but all imports must be from either the standard library or the crate so that the code can be correctly expanded by the cargo run expand command.

Expanding

The cargo run expand command will expand a solution file into a submission file. By default, it will save the submission file to the clipboard, but you can also save it to a file with the -o flag.

Running

The cargo run code command will run the main function of the solution file corresponding to the question you pass as an argument. For example, cargo run code -q b will run the main function of src/code/b.rs.

Stress testing

The cargo run stress [-q] command will stress test a solution with a brute force solution. It will run both solutions on random inputs and compare the results. If they are different, it will print the input and the diff of the outputs. The brute force solution and generator files are both located in src/code/stress/.

komodo-rs's People

Contributors

viniciusth avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.