5 use Test
::More tests
=> 7;
6 BEGIN { use_ok
('Games::Ratings::LogisticElo', 'multi_elo') };
8 my $player = Games
::Ratings
::LogisticElo
->new;
9 $player->set_rating(2240);
10 $player->set_coefficient(15);
12 opponent_rating
=> 2114,
15 my $rating_change = int ($player->get_rating_change + 0.5);
16 my $new_rating = int ($player->get_new_rating + 0.5);
18 is
$rating_change, 5, 'rating change';
19 is
$new_rating, 2245, 'new rating';
23 map { int ($_ + 0.5) } @_
26 my @ratings = clean_ratings multi_elo
[2240, 5];
27 is_deeply
[@ratings], [2240], 'multi_elo - 1 arg';
29 @ratings = clean_ratings multi_elo
[2240, 5], [2114, 2];
30 is_deeply
[@ratings], [2245, 2109], 'multi_elo - 2 args';
32 @ratings = clean_ratings multi_elo
30, [2114, 2], [2240, 5];
33 is_deeply
[@ratings], [2104, 2250], 'multi_elo - 2 args, custom K';
36 $player = Games
::Ratings
::LogisticElo
->new;
37 $player->set_rating(2240);
38 $player->set_coefficient(15);
40 opponent_rating
=> 2240,
43 $rating_change = int ($player->get_rating_change + 0.5);
44 is
$rating_change, 0, 'rating change (only draws against self)';
This page took 0.025512 seconds and 4 git commands to generate.