File Coverage

blib/lib/Poker/Score/Low8.pm
Criterion Covered Total %
statement 6 17 35.2
branch n/a
condition n/a
subroutine 2 4 50.0
pod n/a
total 8 21 38.1


line stmt bran cond sub pod time code
1             package Poker::Score::Low8;
2 1     1   610 use Moo;
  1         1  
  1         4  
3 1     1   161 use Algorithm::Combinatorics qw(combinations);
  1         1  
  1         183  
4              
5             =head1 NAME
6              
7             Poker::Score::Low8 - Identify and score lowball 8 or better poker hand.
8              
9             =head1 VERSION
10              
11             Version 0.01
12              
13             =cut
14              
15             our $VERSION = '0.01';
16              
17             =head1 INTRODUCTION
18              
19             This scoring system is typically used in split-pot games.
20              
21             =head1 SYNOPSIS
22              
23             See Poker::Score for code example.
24              
25             =cut
26              
27             extends 'Poker::Score';
28              
29             sub _build_rank_map {
30 0     0     my $self = shift;
31 0           $self->_rank_map({
32             'A' => '01',
33             '2' => '02',
34             '3' => '03',
35             '4' => '04',
36             '5' => '05',
37             '6' => '06',
38             '7' => '07',
39             '8' => '08',
40             '9' => '09',
41             'T' => '10',
42             'J' => '11',
43             'Q' => '12',
44             'K' => '13',
45             });
46             }
47              
48             sub _build_hands { # generates all possible low8 hands
49 0     0     my $self = shift;
50 0           my @scores;
51 0           my $iter = combinations([1..8], 5);
52 0           while (my $c = $iter->next) {
53 0           push( @scores, join( "", map { sprintf("%02d", $_) } sort { $b <=> $a } @$c ) );
  0            
  0            
54             }
55 0           $self->hands([ sort { $b <=> $a } @scores ]);
  0            
56             #$self->_hand_map( {} );
57             }
58              
59             =head1 AUTHOR
60              
61             Nathaniel Graham, C<< >>
62              
63             =head1 LICENSE AND COPYRIGHT
64              
65             Copyright 2016 Nathaniel Graham.
66              
67             This program is free software; you can redistribute it and/or modify it
68             under the terms of the the Artistic License (2.0). You may obtain a
69             copy of the full license at:
70              
71             L
72              
73             =cut
74              
75             1;