wiki:Rounds

Rounds

This page is a work in progress. I know exactly how to do this, but right now I'm too tired to properly document.

Rounds are groups of tasks that have to be solved in a certain time interval. A 'contest' in the users view might consist of several rounds. For instance preoni 2007 will consist of 3 * 6 actual rounds: 6 contest days spread over a long time interval with 3 age groups each. I don't think that the notion of a 'contest' needs any particular handling in code.

The big round object needs the following:

  • Title, home page, etc.
  • Starting and stopping, by hand or scheduling.
  • Registration: no registration/private registration(by admins)/public registration(maybe with a questionary).

We can't expect to do everything a round could require by just looking in the db and checking the current time. Instead the round is an active object which runs code in the judge. A running round is actually stateful and can change the db, unlike every other object.

Starting and stopping

We need to execute custom logic when a round starts and when it ends (ratings? anyone?). The right way to do this is to implements some sort of a message queue (probably in the DB) but for now we can just have the judge? detect changes in ia_round.

A round (any round) can be either running or stopped. When stopped you can start it yourself or schedule the starting time (which goes in ia_round). If the round is running then we display a big ugly red warning in the round editor and deny most changes. When running we can force the round to stop (maybe we detected a security glitch? whatever).

Without a message queue we can start rounds by setting the start time to NOW() and stop them by setting it in the future. This is a very crappy solution.

Registration

This is a feature with lower priority. We need 3 kinds of registration (it will end up as an enum in the db):

  • Automatic/No? registration: User is registered if when he sends a task.
  • Private registration: Done by admins in a control panel, for things like live contests.
  • Public registration: Users are asked to register. We could have a questionary on the registration page, but that's not essential.

Security

All of these ideas for contest logic depend on cubical security, there is little we can do without a proper security system. Round security is not actually done in round code, instead when starting/stopping rounds we tweak security settings (like adding to the active-rounds group).

Types of rounds

Right now we have two types of rounds:

  • Classical contest rounds, with a bunch of tasks. We can start/stop them and they update ratings at the end. They have a round-duration thing in params
  • Training archive rounds, which never end. We can have more than one (prahova bootcamp, etc).