Algorithm-Pair-Best2
view release on metacpan or search on metacpan
---
abstract: 'select pairings (designed for Go tournaments, but can be used for anything).'
author:
- 'Reid Augustin <reid@hellosix.com>'
build_requires:
IO::File: '0'
Test::More: '0'
configure_requires:
ExtUtils::MakeMaker: '0'
dynamic_config: 0
generated_by: 'Dist::Zilla version 5.020, CPAN::Meta::Converter version 2.142060'
license: perl
Makefile.PL view on Meta::CPAN
use strict;
use warnings;
use 5.002;
use ExtUtils::MakeMaker ;
my %WriteMakefileArgs = (
"ABSTRACT" => "select pairings (designed for Go tournaments, but can be used for anything).",
"AUTHOR" => "Reid Augustin <reid\@hellosix.com>",
"CONFIGURE_REQUIRES" => {
"ExtUtils::MakeMaker" => 0
},
"DISTNAME" => "Algorithm-Pair-Best2",
"EXE_FILES" => [],
"LICENSE" => "perl",
"NAME" => "Algorithm::Pair::Best2",
"PREREQ_PM" => {
"Carp" => 0,
lib/Algorithm/Pair/Best2.pm view on Meta::CPAN
#
use 5.002;
use strict;
use warnings;
package Algorithm::Pair::Best2;
our $VERSION = '2.040'; # VERSION
# ABSTRACT: select pairings (designed for Go tournaments, but can be used for anything).
use Carp;
sub new {
my ($proto, %args) = @_;
my $self = {};
$self->{scoreSub} = delete $args{scoreSub}
|| sub { croak "No scoreSub() callback" };
$self->{items} = delete $args{items} || [];
lib/Algorithm/Pair/Best2.pm view on Meta::CPAN
1;
__END__
=pod
=encoding UTF-8
=head1 NAME
Algorithm::Pair::Best2 - select pairings (designed for Go tournaments, but can be used for anything).
=head1 VERSION
version 2.040
=head1 SYNOPSIS
use Algorithm::Pair::Best2;
my $pair = Algorithm::Pair::Best2->new( [ options ] );
lib/Algorithm/Pair/Best2.pm view on Meta::CPAN
=item $pair-E<gt>B<add> ( item, [ item, ...] )
Add an item (or several items) to be paired. Item(s) can be any scalar
or reference. They will be passed (a pair at a time) to the B<scoreSub>
callback.
=item @new_pairs = $pair-E<gt>B<pick> ( ?$window? )
Returns the best pairing found using the sliding window technique as
discussed in DESCRIPTION above. B<window> is the number of pairs in the
sliding window. If no B<window> argument is passed, the B<window> selected
in the B<new>, or the default value is used.
B<pick> returns the list (or a reference to the list in scalar context) of
items in pairing order: new_pair[0] is paired to new_pair[1], new_pair[2]
to new_pair[3], etc.
If the number of items in the list (from B<add>) is not even, an exception
is thrown.
=back
( run in 0.245 second using v1.01-cache-2.11-cpan-94b05bcf43c )