26c19f9ab42ba2aee551b535f60d8264290285b6
[gruntmaster-daemon.git] / lib / Gruntmaster / Daemon / Judge / Points.pm
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/;
10
11 our $VERSION = '5999.000_004';
12
13 ##################################################
14
15 sub judge{
16 no warnings qw/numeric/;
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)
20 }
21
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;
34 Gruntmaster::Daemon::Judge::Points::judge($result1, $result2, $result3, ...);
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
This page took 0.023331 seconds and 3 git commands to generate.