line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Poker::Score::Badugi27; |
2
|
1
|
|
|
1
|
|
1756
|
use Moo; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
5
|
|
3
|
1
|
|
|
1
|
|
650
|
use Algorithm::Combinatorics qw(combinations); |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
=head1 NAME |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
Poker::Score::Badugi27 - Scoring system used in the game of Badeucy. |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
=head1 VERSION |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
Version 0.01 |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
=cut |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
our $VERSION = '0.01'; |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
=head1 INTRODUCTION |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
Normally the lowest Badugi is A-2-3-4. However, in Badeucy aces are also high for the Badugi hand. This makes the best Badugi hand 2-3-4-5. |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
=head1 SYNOPSIS |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
See Poker::Score for code example. |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
=cut |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
extends 'Poker::Score::Badugi'; |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
sub _build_rank_map { |
30
|
|
|
|
|
|
|
my $self = shift; |
31
|
|
|
|
|
|
|
$self->_rank_map( |
32
|
|
|
|
|
|
|
{ |
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
|
|
|
|
|
|
|
'A' => '14', |
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
); |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
sub _build_hands { # generates all possible Badugi hands |
51
|
|
|
|
|
|
|
my $self = shift; |
52
|
|
|
|
|
|
|
my @all_scores = (); |
53
|
|
|
|
|
|
|
for my $count ( 1 .. 4 ) { |
54
|
|
|
|
|
|
|
my @scores; |
55
|
|
|
|
|
|
|
my $iter = combinations( [ 2 .. 14 ], $count ); |
56
|
|
|
|
|
|
|
while ( my $c = $iter->next ) { |
57
|
|
|
|
|
|
|
push( @scores, |
58
|
|
|
|
|
|
|
join( '', map { sprintf( "%02d", $_ ) } sort { $b <=> $a } @$c ) ); |
59
|
|
|
|
|
|
|
} |
60
|
|
|
|
|
|
|
$self->_hand_map->{scalar @all_scores} = $count . ' card Badugi'; |
61
|
|
|
|
|
|
|
push @all_scores, sort { $b <=> $a } @scores; |
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
$self->hands( [@all_scores] ); |
64
|
|
|
|
|
|
|
} |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=head1 AUTHOR |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
Nathaniel Graham, C<< >> |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
=head1 LICENSE AND COPYRIGHT |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
Copyright 2016 Nathaniel Graham. |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it |
75
|
|
|
|
|
|
|
under the terms of the the Artistic License (2.0). You may obtain a |
76
|
|
|
|
|
|
|
copy of the full license at: |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
L |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
=cut |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
1; |