=item PASCAL
- fpc -dONLINE_JUDGE -O2 -n $input
+ fpc -dONLINE_JUDGE -O2 $input
=item PERL
--- /dev/null
+=encoding utf-8
+
+=head1 NAME
+
+Gruntmaster::Daemon::Generator - Modules for generating input files
+
+=head1 SYNOPSIS
+
+ use Gruntmaster::Daemon::Generator::Foo;
+ Gruntmaster::Daemon::Generator::Foo::generate(5, $meta);
+
+=head1 DESCRIPTION
+
+A generator is a module that creates input data. Each generator has a subroutine, B<generate>(I<$test>, I<$meta>), which generates the input data for the given test.
+
+There are three generators in this distribution:
+
+=over
+
+=item L<Gruntmaster::Daemon::Generator::File> - Generate tests from files
+
+=item L<Gruntmaster::Daemon::Generator::Run> - Generate tests from program output
+
+=item L<Gruntmaster::Daemon::Generator::Undef> - Pretend to generate tests
+
+=back
+
+=head1 AUTHOR
+
+Marius Gavrilescu E<lt>marius@ieval.roE<gt>
+
+=head1 COPYRIGHT AND LICENSE
+
+Copyright (C) 2014 by Marius Gavrilescu
+
+This library is free software: you can redistribute it and/or modify
+it under the terms of the GNU Affero General Public License as published by
+the Free Software Foundation, either version 3 of the License, or
+(at your option) any later version.
+
+
+=cut
=head1 SYNOPSIS
use Gruntmaster::Daemon::Generator::File;
- Gruntmaster::Daemon::Generator::File->generate(5, $meta);
+ Gruntmaster::Daemon::Generator::File::generate(5, $meta);
=head1 DESCRIPTION
-Gruntmaster::Daemon::Generator::File is a static test generator. Test C<$i> is C<< $meta->{infile}[$i - 1] >>.
+Gruntmaster::Daemon::Generator::File is a static test generator.
+If C<< $meta->{infile} >> exists, the input for test C<$i> is C<< $meta->{infile}[$i - 1] >>.
+Otherwise, the input for test C<$i> is F<< /var/lib/gruntmasterd/pb/$meta->{problem}/$test.in >>.
=head1 AUTHOR
=head1 DESCRIPTION
-Gruntmaster::Daemon::Generator::Run is a dynamic test generator. Test C<$i> is the output of running C<< $meta->{files}{gen} >> with argument C<$i>.
+Gruntmaster::Daemon::Generator::Run is a dynamic test generator. The input for test C<$i> is the output of running C<< $meta->{files}{gen} >> with argument C<$i>.
=head1 AUTHOR
--- /dev/null
+=encoding utf-8
+
+=head1 NAME
+
+Gruntmaster::Daemon::Judge - Modules for judging jobs
+
+=head1 SYNOPSIS
+
+ use Gruntmaster::Daemon::Runner::Foo;
+ my $verdict = Gruntmaster::Daemon::Runner::Foo::judge(@results);
+
+=head1 DESCRIPTION
+
+A judge is a module that takes a list of verdicts and returns a single, combined verdict.
+
+There are two judges in this distribution:
+
+=over
+
+=item L<Gruntmaster::Daemon::Judge::Absolute> - All-or-nothing ACM-style judge
+
+=item L<Gruntmaster::Daemon::Judge::Points> - 0 to 100 points IOI-style judge
+
+=back
+
+=head1 AUTHOR
+
+Marius Gavrilescu E<lt>marius@ieval.roE<gt>
+
+=head1 COPYRIGHT AND LICENSE
+
+Copyright (C) 2014 by Marius Gavrilescu
+
+This library is free software: you can redistribute it and/or modify
+it under the terms of the GNU Affero General Public License as published by
+the Free Software Foundation, either version 3 of the License, or
+(at your option) any later version.
+
+
+=cut
=head1 SYNOPSIS
use Gruntmaster::Daemon::Judge::Absolute;
- Gruntmaster::Daemon::Judge::Absolute->judge($result1, $result2, $result3, ...);
+ Gruntmaster::Daemon::Judge::Absolute::judge($result1, $result2, $result3, ...);
=head1 DESCRIPTION
=head1 SYNOPSIS
use Gruntmaster::Daemon::Judge::Points;
- Gruntmaster::Daemon::Judge::Points->judge($result1, $result2, $result3, ...);
+ Gruntmaster::Daemon::Judge::Points::judge($result1, $result2, $result3, ...);
=head1 DESCRIPTION
--- /dev/null
+=encoding utf-8
+
+=head1 NAME
+
+Gruntmaster::Daemon::Runner - Modules for running tests
+
+=head1 SYNOPSIS
+
+ use Gruntmaster::Daemon::Runner::Foo;
+ Gruntmaster::Daemon::Runner::Foo::run(5, $meta);
+
+=head1 DESCRIPTION
+
+A runner is a module that runs a program on some input data, returning a verdict. Each runner has a subroutine, B<run>(I<$test>, I<$meta>), which runs the program on the given test and returns a verdict.
+
+If the test is successful, the verdict is a string, usually a message (such as C<"Ok">) or a number of points (such as C<"10">). Otherwise, the verdict is an array reference with two elements: an error code (see L<Gruntmaster::Daemon::Constants> for a list) and an error message.
+
+There are three runners in this distribution:
+
+=over
+
+=item L<Gruntmaster::Daemon::Runner::File> - Compare output with static text files
+
+=item L<Gruntmaster::Daemon::Runner::Verifier> - Check the program output with a verifier
+
+=item L<Gruntmaster::Daemon::Runner::Interactive> - Make an interactive verifier talk to the program
+
+=back
+
+=head1 AUTHOR
+
+Marius Gavrilescu E<lt>marius@ieval.roE<gt>
+
+=head1 COPYRIGHT AND LICENSE
+
+Copyright (C) 2014 by Marius Gavrilescu
+
+This library is free software: you can redistribute it and/or modify
+it under the terms of the GNU Affero General Public License as published by
+the Free Software Foundation, either version 3 of the License, or
+(at your option) any later version.
+
+
+=cut
if (exists $meta->{okfile}) {
$ok = $meta->{okfile}[$test - 1]
} else {
- my $ct = defined $Gruntmaster::Data::contest ? "ct/$Gruntmaster::Data::contest" : '';
- $ok = slurp "/var/lib/gruntmasterd/$ct/pb/$meta->{problem}/$test.ok"
+ $ok = slurp "/var/lib/gruntmasterd/pb/$meta->{problem}/$test.ok"
}
$out =~ s/^\s+//;
=head1 SYNOPSIS
use Gruntmaster::Daemon::Runner::File;
- Gruntmaster::Daemon::Runner::File->run(5, $meta);
+ Gruntmaster::Daemon::Runner::File::run(5, $meta);
=head1 DESCRIPTION
-Gruntmaster::Daemon::Runner::File is a runner which compares the program output for test C<$test> with C<< $meta->{tests}[$test - 1] >>. Before comparing, leading and trailing whitespace is removed, and sequences of whitespace are converted to a single space.
+Gruntmaster::Daemon::Runner::File is a runner which compares the program output for test C<$test> with a static output. Before comparing, leading and trailing whitespace is removed, and sequences of whitespace are converted to a single space.
+
+If C<< $meta->{okfile} >> exists, the output is compared to C<< $meta->{okfile}[$test - 1] >>.
+Otherwise, the output is compared to F<< /var/lib/gruntmasterd/pb/$meta->{problem}/$test.ok >>.
+
+If the two strings match, the verdict is C<< $meta->{tests}[$test - 1] >>. Otherwise, the verdict is C<[WA, "Wrong answer"]>.
=head1 AUTHOR
=head1 SYNOPSIS
use Gruntmaster::Daemon::Runner::Interactive;
- Gruntmaster::Daemon::Runner::Interactive->run(5, $meta);
+ Gruntmaster::Daemon::Runner::Interactive::run(5, $meta);
=head1 DESCRIPTION
B<WARNING: This runner is experimental!>
-Gruntmaster::Daemon::Runner::Interactive is a runner which runs the program and an interactive verifier in parallel, connecting each program's STDIN to the other's STDOUT. The verifier, C<< $meta->{files}{int} >>, should return nonzero if the program gives an incorrect answer, and print the test score to fd 4 then return 0 if the answer is correct.
+Gruntmaster::Daemon::Runner::Interactive is a runner which runs the program and an interactive verifier in parallel, connecting each program's STDIN to the other's STDOUT. The verifier, C<< $meta->{files}{ver} >>, should return nonzero if the program gives an incorrect answer, or print the test score to fd 4 then return 0 if the answer is correct.
=head1 AUTHOR
=head1 SYNOPSIS
use Gruntmaster::Daemon::Runner::Verifier;
- Gruntmaster::Daemon::Runner::Verifier->run(5, $meta);
+ Gruntmaster::Daemon::Runner::Verifier::run(5, $meta);
=head1 DESCRIPTION