The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Games::Ratings - generic methods for rating calculation (e.g. chess ratings)

VERSION

This document describes Games::Ratings version 0.0.5

SYNOPSIS

 ## not very useful, but one could do
 
 use Games::Ratings;
 my $player = Games::Ratings->new();
 $player->set_rating(2240);
 $player->add_game( {
                      opponent_rating => 2114,
                      result          => 'win',   ## or 'draw' or 'loss'
                    }
                  );
 my $n                = $player->get_number_of_games_played();
 my $points_scored    = $player->get_points_scored();
 my $opponents_rating = $player->get_average_rating_of_opponents();
 $player->remove_all_games;

  

DESCRIPTION

Games::Ratings provides some generic methods for other, more specific modules (like Games::Ratings::Chess::FIDE or Games::Ratings::Chess::DWZ). It isn't very useful for itself.

INTERFACE

The following methods can be accessed from more specific modules -- like Games::Ratings::Chess::FIDE. Also specific methods for rating calculation are defined in those other modules.

new

  my $player = Games::Rating->new();

Create an object for storing rating and other data (like the FIDE development coefficient) for one player as well as informations about rated games of this player against some opponents.

set_rating

  $player->set_rating(2235);

Set rating of player.

get_rating

  my $own_rating = $player->get_rating();

Get rating of player.

set_coefficient

  $player->set_coefficient(15);

Set development coefficient of player. (A development coefficient is needed for calculation of some ratings: * FIDE Elo (FIDE Handbook, B.02.10.52) * German DWZ (Wertungsordnung des DSB, Punkt 4.9.2)).

get_coefficient

  my $own_coefficient = $player->get_coefficient();

Get development coefficient of player.

add_game

  $player->add_game( {
                       opponent_rating => 2184,
                       result          => 'draw',
                     }
                   );

Add rated game to object. We need opponents rating and the result of the game. Results are one of 'win', 'draw' or 'loss'. The data is passed as hash reference.

get_all_games

  my @list_of_games = $player->get_all_games();

Get list of previously added games. Each game is represented by a hash reference (cmp. $player->add_game() ).

remove_all_games

  $player->remove_all_games();

Remove all games added (via 'add_game') so far.

DESTROY

  $player->DESTROY();

Remove object $player.

get_number_of_games_played

  my $n = $player->get_number_of_games_player();

Get number of games played.

get_points_scored

  my $points_scored = $player->get_points_scored();

Get total points scored in played games. A win gives 1 point, a draw gives 0.5 points, a loss gives 0 points.

get_percentage_score

  my $percentage_score = $player->get_percentage_score();

Get percentage score in played games.

get_average_rating_of_opponents

  my $opponents_rating = $player->get_average_rating_of_opponents();

Get average rating of opponents for played games.

DIAGNOSTICS

At the moment, there are no error or warning messages that the module can generate.

Error message here, perhaps with %s placeholders

[Description of error here]

Another error message here

[Description of error here]

CONFIGURATION AND ENVIRONMENT

Games::Ratings requires no configuration files or environment variables.

DEPENDENCIES

Requires the Class::Std::Utils module and the version module. Needs Perl 5.6.1 or higher.

INCOMPATIBILITIES

None reported.

BUGS AND LIMITATIONS

No bugs have been reported.

Please report any bugs or feature requests to bug-games-ratings@rt.cpan.org, or through the web interface at http://rt.cpan.org.

AUTHOR

Christian Bartolomaeus <bartolin@gmx.de>

ACKNOWLEDGMENTS

This module was inspired by Terrence Brannon's module Chess::Elo (http://search.cpan.org/~tbone/Chess-Elo/).

SEE ALSO

http://en.wikipedia.org/wiki/Elo_rating for informations about the Elo system.

LICENCE AND COPYRIGHT

Copyright (c) 2010, Christian Bartolomaeus <bartolin@gmx.de>. All rights reserved.

This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See perlartistic.

DISCLAIMER OF WARRANTY

BECAUSE THIS SOFTWARE IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE SOFTWARE, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE SOFTWARE "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE IS WITH YOU. SHOULD THE SOFTWARE PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR, OR CORRECTION.

IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE SOFTWARE AS PERMITTED BY THE ABOVE LICENCE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE SOFTWARE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE SOFTWARE TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.