Score/Low8.pm

filter: Statementstmt 100% 20 / 20 Branchbran 100% 2 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 4 / 4 Podpod n/a totaltotal 100% 26 / 26 CC 2 SCAR 3.4
CC
2
Cov
100%
_build_hands
2.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.4
« Score/Chinese.pm ↑ Summary Score/Bring/Low.pm »
1 package Poker::Score::Low8;
2 4 our $VERSION = '0.12';
3  
4  
5 4 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 4 ▶use Algorithm::Combinatorics qw(combinations);
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 =head1 NAME
9  
10 Poker::Score::Low8 - Identify and score lowball 8 or better poker hand.
11  
12 =head1 VERSION
13  
14 Version 0.12
15  
16 =cut
17  
18  
19 =head1 INTRODUCTION
20  
21 This scoring system is typically used in split-pot games.
22  
23 =head1 SYNOPSIS
24  
25 See Poker::Score for code example.
26  
27 =cut
28  
29 4 extends 'Poker::Score';
30  
31 4 ▶sub _build_rank_map {
Subroutine _build_rank_map: called CC=1 SCAR=0.0
32 4 my $self = shift;
33 4 $self->_rank_map({
34 'A' => '01',
35 '2' => '02',
36 '3' => '03',
37 '4' => '04',
38 '5' => '05',
39 '6' => '06',
40 '7' => '07',
41 '8' => '08',
42 '9' => '09',
43 'T' => '10',
44 'J' => '11',
45 'Q' => '12',
46 'K' => '13',
47 });
48 }
49  
50 4 ▶sub _build_hands { # generates all possible low8 hands
Subroutine _build_hands: called CC=2 SCAR=6.9
51 4 my $self = shift;
52 4 my @scores;
53 4 my $iter = combinations([1..8], 5);
54 4 ▶ while (my $c = $iter->next) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $c = $iter->next) 224 4 228
55 224 push( @scores, join( "", map { sprintf("%02d", $_) } sort { $b <=> $a } @$c ) );
56 }
57 4 $self->hands([ sort { $b <=> $a } @scores ]);
58 #$self->_hand_map( {} );
59 }
60  
61 =head1 AUTHOR
62  
63 Nathaniel Graham, C<< <ngraham at cpan.org> >>
64  
65 =head1 LICENSE AND COPYRIGHT
66  
67 Copyright 2016 Nathaniel Graham.
68  
69 This program is free software; you can redistribute it and/or modify it
70 under the terms of the the Artistic License (2.0). You may obtain a
71 copy of the full license at:
72  
73 L<http://www.perlfoundation.org/artistic_license_2_0>
74  
75 =cut
76  
77 4 1;
« Score/Chinese.pm ↑ Summary Score/Bring/Low.pm »