Code Monkey home page Code Monkey logo

generator-oj-problem's Introduction

Generator-OJ-Problem

Downloads

A command-line tool to generate Online-Judge problem.

  • Render problem descriptions in Markdown to HTML
  • Check problem descriptions and data, including missing fields, UTF-8 encoding, end-of-line CRLF/LF
  • Packing problem data in freeproblemset(hustoj) format
  • Mechanism for generating input and output test data
  • Easy to define adapters for other online-judge platform

Have fun! If you have any suggestions or find any bugs, please tell me.

Install

pip install generator-oj-problem

# or use pipx for a standalone python environment
pip install pipx
pipx ensurepath
pipx install generator-oj-problem

gop --help

Usage

# Initialize your problem
gop init

# Modify the files to write problem
ls .

# Generate 2 sample data from id 1
gop gen -s 1 -c 2 --sample
# Generate 5 test data from id 2
gop gen -s 2 -c 5

# Trim sample and test data
gop trim

# Check validaty
gop check

# Pack your problem in FreeProblemSet format
gop -a fps pack

If you meet some encoding errors, ensure your Python interpreter runs in UTF-8 mode, e.g. adding PYTHONUTF8=1 to your environment variables.

Directory Structure

Here is a demo problem A + B Problem. Details about problem.yml and generator.py are given at the comments of the demo files.

The file with extension .md means it supports plain CommonMark by built-in render. Attention: No LaTeX and embeded image supports.

  • problem.yml Problem metadata and configuration
  • description.md Description
  • input.md Description of input
  • output.md Description of output
  • hint.md Hint
  • solution.txt Solution source code
  • generator.py Generator for input or output data.
  • samples/ Sample data
    • samples/0.in Input of sample
    • samples/0.out Output of sample
  • tests/ Test data (same form to samples/)

generator-oj-problem's People

Contributors

stardustdl avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

generator-oj-problem's Issues

Founded issues in beta-version

  • Not stable for local-judger #2
    • Use StarOJ's judger
    • Add more diff log
  • Add debug pack for debug
  • System Error when gen sometimes.
    • Permission issue on Linux
  • Check file encoding to ensure UTF-8

Will/Won't implement:

  • push for hustoj

Founded issues in alpha-version

  • Check the directory is empty
    • Show tips
  • Optional package (implemented by pipeline)
  • Markdown render
  • Local judging check
    • Warning for time limit and memory limit
  • HTML preview
  • Platform-related packer
  • Auto-generate output data
  • Support dotnet tool
  • Process.StartTime for exited process do not support Linux-x64.
    RunningTime = DateTimeOffset.Now - Process.StartTime;
  • Unhandled exception in callback functions will crash the application
    Process.Exited += (sender, e) =>
    {
    RunningTime = DateTimeOffset.Now - Process.StartTime;
    if (bwMemory?.IsBusy == true) bwMemory.CancelAsync();
    Process.WaitForExit();
    var output = new List<string>();
    while (!Process.StandardOutput.EndOfStream)
    output.Add(Process.StandardOutput.ReadLine());
    Output = output.ToArray();
    var error = new List<string>();
    while (!Process.StandardError.EndOfStream)
    error.Add(Process.StandardError.ReadLine());
    Error = error.ToArray();
    };
  • Add auto-detect
  • Add more logs when use
  • Use FPS for HustOJ package
  • Add basic check before gen
  • Add debug information for failing.
    • Add builtin log in pipeline

Won't be implemented:

  • Add update-pack
    • Add backup for each package: sha and time
    • Add file list for package
    • Add delta-addition for package

[BUGs] Wrong "WA" result caused by count of lines

Try gen again and then the Warning and Error gone.

[Warning] Diff for sample 0: The count of lines are not equal: expected System.Collections.Generic.List`1[System.String], but real System.Collections.Generic.List`1[System.String].
[Error] Wrong answer for sample 0.

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.