]>
Commit | Line | Data |
---|---|---|
5c5cd38a MG |
1 | package Gruntmaster::Daemon::Judge::Points; |
2 | ||
3 | use 5.014000; | |
4 | use strict; | |
5 | use warnings; | |
6 | ||
7 | use Gruntmaster::Daemon::Constants qw/AC REJ/; | |
8 | use List::Util qw/sum/; | |
9 | use Log::Log4perl qw/get_logger/; | |
bc372959 | 10 | |
3fa65372 | 11 | our $VERSION = '5999.000_005'; |
5c5cd38a MG |
12 | |
13 | ################################################## | |
14 | ||
15 | sub judge{ | |
7e81b08a | 16 | no warnings qw/numeric/; |
a722431b MG |
17 | get_logger->trace("Judging results: @_"); |
18 | my $points = sum 0, grep { !ref } @_; | |
19 | $points == 100 ? (result => AC, result_text => 'Accepted') : (result => REJ, result_text => "$points points", points => $points) | |
5c5cd38a MG |
20 | } |
21 | ||
8aec2ffe MG |
22 | 1; |
23 | __END__ | |
24 | ||
25 | =encoding utf-8 | |
26 | ||
27 | =head1 NAME | |
28 | ||
29 | Gruntmaster::Daemon::Judge::Points - 0 to 100 points IOI-style judge | |
30 | ||
31 | =head1 SYNOPSIS | |
32 | ||
33 | use Gruntmaster::Daemon::Judge::Points; | |
0005d3ad | 34 | Gruntmaster::Daemon::Judge::Points::judge($result1, $result2, $result3, ...); |
8aec2ffe MG |
35 | |
36 | =head1 DESCRIPTION | |
37 | ||
38 | Gruntmaster::Daemon::Judge::Points is a judge which adds up the given results and returns C<Accepted> if the final score is 100 points or C<X points> otherwise. | |
39 | ||
40 | =head1 AUTHOR | |
41 | ||
42 | Marius Gavrilescu E<lt>marius@ieval.roE<gt> | |
43 | ||
44 | =head1 COPYRIGHT AND LICENSE | |
45 | ||
46 | Copyright (C) 2014 by Marius Gavrilescu | |
47 | ||
48 | This library is free software: you can redistribute it and/or modify | |
49 | it under the terms of the GNU Affero General Public License as published by | |
50 | the Free Software Foundation, either version 3 of the License, or | |
51 | (at your option) any later version. | |
52 | ||
53 | ||
54 | =cut |