Instructions for PC^2 Lite Judging Environment
Getting Started
Download PC^2 Lite and install in home directory.
Download Judging scripts and install in home directory.
After you've done this you should have two directories: pc2 and scripts.
To start a server
Edit pc2/pc2v7.ini to change the server to the name of your local machine.
(All clients will have to do likewise.) Don't change the Site Id which is
"Waterloo."
Copy some boilerplate contest database files to your home directory:
cp -r scripts/db.std8 db
cp -r scripts/r_db.std8 r_db
Start the registry and server:
pc2/registry
pc2/server
Start several clients:
pc2/client
Each client will bring up a login screen. Log in as the following:
pc2 (passwd pc2)
judge1 (passwd judge1)
board1 (passwd board1)
team1 (passwd team1)
- pc2 is the administrator account. Use it to configure the problems and
to start/stop the contest. Also use it to examine "runs" and use "give"
to give a problem to the judge if you need to re-judge a previously judged
submission. You can also use pc2 to force the logout of another account
(which becomes necessary when a client machine crashes and the account is
listed as "in use" when they try to log in again). Note that there is
a backup admin1 account (passwd iamadmin1) that you can use to kick pc2
off it its client session crashes!
-
judge1 is the judge account. Submissions and clarification requests will
come to this account. Judging is semi-automatic.
-
board1 is the scoreboard account. It must be running for the scoreboard
scripts to work.
-
team1 is a team account. You can use it to make submissions to test your
setup.
Configuring problems and judging
Use the pc2 account to edit the problem descriptions. You can set the
problem names. You can add new problems (if there are more than 8) but
you can't delete them. So if you need fewer than 8 the easiest thing
to do is to set the problem name to blank and ignore it.
For judging you have two choices:
- 1. programs can read from standard input
and write to standard output (as in the ECNA regionals)
- 2. programs can read from a file name specified in the problem statement
and write to standard output (as in the World finals)
If you want to read from standard input, just leave the input file blank.
If you want to read from a file name, you have to fill it in using the pc2
account. Although the contents of the file are irrelevant, you cannot fill
in a filename unless the file exists! So if you want input to come from
"blah.in" just create an empty file "blah.in" and select it.
The judge script should be "jj". If you need to create more than 8 problems
you'll find a copy of "jj" in scripts/jj.
Judging Data
All judging data must be in the directory ${HOME}/data. Problems are always
labelled A, B, C, .... in the order created.
You may test the program with several input files. Each input file should
have the name X.*.dat where X is the problem name and * is anything you please.
If you have a correct output file for comparision, it is named X.*.diff
where of course the substitution for * matches that for the .dat file.
If you have a judging program rather than a correct output file, it is
named X.*.cmd and must be executable. The return code from running this
script is used to determine the suggested judgement. When this script is
run, argv[0] is the full pathname to the script in the data directory,
and argv[1] is the full pathname of the contestant's output file.
The above comments (.dat, .diff, .cmd files) apply whether the programs read
from standard input or a specific filename. If programs are to read from
filename this fact is specified by the existence of a file:
X.filename.inp
Archiving and storing configurations
If you have gone to all the trouble of configuring the contest, you may want
to try it out to see if it works. Unfortunately lots of things you might do
(like submitting problems) are essentially irreversible in PC^2. So you
want to take a snapshot of the system. Here's how to do it:
Taking a snapshot of the system
- Kill the registry and the server (on linux, "killall java" works nicely).
This is very important
- Copy db and r_db someplace save.
- Restart registry, server, clients.
Restoring the system from a snapshot
- Kill the registry and the server
- Remove or rename db and r_db
- Copy your snapshots of db and r_db into place
- Restart registry, server, clients.
Scoreboard
The scoreboard is yet another kludge. Here goes:
- make sure you have a directory ${HOME}/public_html/scoreboard
- edit scripts/scoreboard/data
- make sure you remove all .log files before you start the servers
- start the servers and log in "board1" client
- run scripts/scoreboard/poll
- two periodically updated scoreboards will appear in the above-mentioned directory -
one uses html tables and one uses plain text
Note: PC^2 only updates the scoreboard when a problem is judged "correct".
This is stupid so I decompiled it and fixed it. To apply the patch, just
download and install this tar file in your home
directory. Then you have to go to pc2/pc2/Board and execute:
javac ScoreboardFrame.java
Killing Zombie Logins
At some point, somebody will manage to kill their pc^2 client
and be unable to login again.
- For team/judge/board accounts, just use the pc2 account and
select "accounts" "view logins" and the appropriate
type (team/judge/admin/board), and you'll see the culprit id on
the list. Select the culprit and hit "logoff"
- The pc2 account is more problematic. To kill pc2 you have to
login to a backup admin account. These have name/pwd
admin1/iamadmin1, admin2/iamadmin2 etc. The admin accounts
have only a subset of the pc2 cababilities but "manage accounts"
is one of them.
What else?
In trying to cut to the chase, I've probably omitted something. Let me know.
The judging stuff is derived from Howard Cheng's
PC2+E: A PC2 Add-on Environment so you might find answers there or
at the PC^2 Web Site. PC^2 Lite
is based on PC^2 version 7.6.