Skip to content
Programming contest judge. Built on top of cirrus.
JavaScript HTML CSS Java Dockerfile Shell Other
Branch: master
Clone or download
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
postgres Moved initial password to env variable Sep 8, 2019
problems/sample Uploaded python sample Aug 15, 2019
public Restyled problems page Aug 15, 2019
server Refactored for cirrus judge Aug 26, 2019
views Added target="_blank" to Github navbar link Aug 26, 2019
.dockerignore Added docker ignore Aug 27, 2019
.env Moved initial password to env variable Sep 8, 2019
.gitignore
Dockerfile Added docker run script Aug 27, 2019
README.md Update README.md Aug 27, 2019
config.json Dockerized database Sep 7, 2019
docker-compose.yml Moved initial password to env variable Sep 8, 2019
docker.sh Updated docker script Aug 27, 2019
index.js Moved initial password to env variable Sep 8, 2019
package-lock.json Hardened endpoints with Joi Jul 3, 2019
package.json npm run format Jul 16, 2019

README.md

contest-judge

A programming judge built on top of the cirrus judging API. Built with the express framework on a postgreSQL database, rendered with EJS.

Deployment

$ git clone https://github.com/chen-robert/contest-judge.git
$ cd contest-judge
$ docker-compose up

By default, the server runs on port 5000. You can change this up editting the .env file. You'll also want to set a new secret for the SECRET_KEY value, which will be used to sign cookies.

Features

  • Automatic problem data generation in one command npm run pdata:gen
  • Admin interface for editting users / configuration
  • Easy, highly configurable problem writing
  • Simple, one command deployment with docker

Directory Structure

EJS template files can be found in /views. Static files can be found in /public. Scripts are located in /public/scripts and styles in /public/styles. Styles are written with less and compiled with express middleware at runtime. Serverside scripts are located in /server, with the main file at /index.js. The configuration file can be located at /config.json.

Development

$ npm run dev

will restart the server on changes.

Problem Configuration

Problems are loaded through seperate directories, specified through the problemDirs of the root config. An example problem directory can be found in problems/sample. Note that the problem directories don't necessarily have to be under problems, though this may help with organization.

Each directory has its own config file, located in config.json under the root directory.

File Description
statement.txt The problem statement. Rendered with markdown and latex.
config.json Additional configuration for the problem. Overrides values set in the default in the problem directory root.
format.txt Optional. Specifies the format for automatic problem data generation.
data The directory storing problem data. Input and output files should be labeled ${num}.in and ${num}.out respectively, with num starting from 0 and going up (non-negative integers).
data/generated Auto-generated problem data.
solution Any solution files for the problem.

format.txt

Comments begin with a #, and comment out everything on the line after it.

Each format file is divided into two parts, seperated by a line beginning with three dashes (---). The first part of the file is the configuration. The configuration consists of a key-value pair on each line, separated by a colon. Below lists valid configuration values.

Value Description
count Number of test cases to generate. Defaults to 1.

The rest of the file defines the format for the test data.

Values

{a:b} is a value representing a random integer from a to b inclusive.

[TYPE:args...] declares an object with type TYPE.

Statements

VAR X ${value} declares a variable called X to some value. X can then be used later in both future variable declarations, as well as outputed.

> ${value} ${value} ${value}... will output all of the values onto a new line.

You can’t perform that action at this time.