line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Poker::Robot::Ring; |
2
|
1
|
|
|
1
|
|
4
|
use Moo; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
5
|
|
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
=encoding utf8 |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
=head1 NAME |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
Poker::Robot::Ring - Simple class to represent a poker table. Used internally by Poker::Robot. |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
=head1 VERSION |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
Version 0.01 |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
=cut |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
our $VERSION = '0.01'; |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
has 'table_min' => ( is => 'rw', ); |
19
|
|
|
|
|
|
|
has 'table_max' => ( is => 'rw', ); |
20
|
|
|
|
|
|
|
has 'bring' => ( is => 'rw', ); |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
has 'class' => ( is => 'rw', ); |
23
|
|
|
|
|
|
|
has 'min_draws' => ( is => 'rw', ); |
24
|
|
|
|
|
|
|
has 'max_draws' => ( is => 'rw', ); |
25
|
|
|
|
|
|
|
has 'min_discards' => ( is => 'rw', ); |
26
|
|
|
|
|
|
|
has 'max_discards' => ( is => 'rw', ); |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
has 'table_id' => ( |
29
|
|
|
|
|
|
|
is => 'rw', |
30
|
|
|
|
|
|
|
); |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
has 'director_id' => ( |
33
|
|
|
|
|
|
|
is => 'rw', |
34
|
|
|
|
|
|
|
); |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
has 'time_bank' => ( |
37
|
|
|
|
|
|
|
is => 'rw', |
38
|
|
|
|
|
|
|
); |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
has 'chair_count' => ( |
41
|
|
|
|
|
|
|
is => 'rw', |
42
|
|
|
|
|
|
|
); |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
has 'player_count' => ( |
45
|
|
|
|
|
|
|
is => 'rw', |
46
|
|
|
|
|
|
|
); |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
has 'pot_cap' => ( |
49
|
|
|
|
|
|
|
is => 'rw', |
50
|
|
|
|
|
|
|
); |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
has 'limit' => ( |
53
|
|
|
|
|
|
|
is => 'rw', |
54
|
|
|
|
|
|
|
); |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
has 'fix_limit' => ( |
57
|
|
|
|
|
|
|
is => 'rw', |
58
|
|
|
|
|
|
|
); |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
has 'max_raise' => ( |
61
|
|
|
|
|
|
|
is => 'rw', |
62
|
|
|
|
|
|
|
); |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
has 'small_bet' => ( |
65
|
|
|
|
|
|
|
is => 'rw', |
66
|
|
|
|
|
|
|
); |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
has 'max_bet' => ( |
69
|
|
|
|
|
|
|
is => 'rw', |
70
|
|
|
|
|
|
|
); |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
has 'turn_clock' => ( |
73
|
|
|
|
|
|
|
is => 'rw', |
74
|
|
|
|
|
|
|
); |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
has 'game_choice' => ( |
77
|
|
|
|
|
|
|
is => 'rw', |
78
|
|
|
|
|
|
|
); |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
has 'dealer_choices' => ( |
81
|
|
|
|
|
|
|
is => 'rw', |
82
|
|
|
|
|
|
|
isa => sub { die "Not an array!" unless ref( $_[0] ) eq 'ARRAY' }, |
83
|
|
|
|
|
|
|
default => sub { [] }, |
84
|
|
|
|
|
|
|
); |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
has 'valid_act' => ( |
87
|
|
|
|
|
|
|
is => 'rw', |
88
|
|
|
|
|
|
|
isa => sub { die "Not an array!" unless ref( $_[0] ) eq 'ARRAY' }, |
89
|
|
|
|
|
|
|
default => sub { [] }, |
90
|
|
|
|
|
|
|
); |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
has 'community_cards' => ( |
93
|
|
|
|
|
|
|
is => 'rw', |
94
|
|
|
|
|
|
|
isa => sub { die "Not an array!" unless ref( $_[0] ) eq 'ARRAY' }, |
95
|
|
|
|
|
|
|
default => sub { [] }, |
96
|
|
|
|
|
|
|
); |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
has 'chairs' => ( |
99
|
|
|
|
|
|
|
is => 'rw', |
100
|
|
|
|
|
|
|
isa => sub { die "Not an array.\n" unless ref( $_[0] ) eq 'ARRAY' }, |
101
|
|
|
|
|
|
|
default => sub { [] }, |
102
|
|
|
|
|
|
|
); |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
has 'round' => ( |
105
|
|
|
|
|
|
|
is => 'rw', |
106
|
|
|
|
|
|
|
); |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
has 'pot' => ( |
109
|
|
|
|
|
|
|
is => 'rw', |
110
|
|
|
|
|
|
|
default => sub { return 0 }, |
111
|
|
|
|
|
|
|
); |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
has 'last_bet' => ( |
114
|
|
|
|
|
|
|
is => 'rw', |
115
|
|
|
|
|
|
|
default => sub { return 0 }, |
116
|
|
|
|
|
|
|
); |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
has 'game_count' => ( # Bool |
119
|
|
|
|
|
|
|
is => 'rw', |
120
|
|
|
|
|
|
|
default => sub { return 0 }, |
121
|
|
|
|
|
|
|
); |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
has 'action' => ( |
124
|
|
|
|
|
|
|
is => 'rw', |
125
|
|
|
|
|
|
|
); |
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
has 'button' => ( |
128
|
|
|
|
|
|
|
is => 'rw', |
129
|
|
|
|
|
|
|
); |
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
has 'ante' => ( |
132
|
|
|
|
|
|
|
is => 'rw', |
133
|
|
|
|
|
|
|
); |
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
has 'big_blind' => ( |
136
|
|
|
|
|
|
|
is => 'rw', |
137
|
|
|
|
|
|
|
); |
138
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
has 'small_blind' => ( |
140
|
|
|
|
|
|
|
is => 'rw', |
141
|
|
|
|
|
|
|
); |
142
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
has 'last_act' => ( is => 'rw', ); |
144
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
has 'game_over' => ( # Bool |
146
|
|
|
|
|
|
|
is => 'rw', |
147
|
|
|
|
|
|
|
); |
148
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
has 'call_amt' => ( |
150
|
|
|
|
|
|
|
is => 'rw', |
151
|
|
|
|
|
|
|
); |
152
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
has 'bet_size' => ( |
154
|
|
|
|
|
|
|
is => 'rw', |
155
|
|
|
|
|
|
|
); |
156
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
has 'card_select' => ( |
158
|
|
|
|
|
|
|
is => 'rw', |
159
|
|
|
|
|
|
|
isa => sub { die "Not an array.\n" unless ref( $_[0] ) eq 'ARRAY' }, |
160
|
|
|
|
|
|
|
); |
161
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
sub total_pot { |
163
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
164
|
0
|
|
|
|
|
|
my $total = $self->pot; |
165
|
0
|
|
|
|
|
|
for my $chair ( grep { defined $_ } @{ $self->chairs } ) { |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
166
|
0
|
|
|
|
|
|
$total += $chair->in_pot_this_round; |
167
|
|
|
|
|
|
|
} |
168
|
0
|
|
|
|
|
|
return $total; |
169
|
|
|
|
|
|
|
} |
170
|
|
|
|
|
|
|
|
171
|
|
|
|
|
|
|
sub pot_odds { |
172
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
173
|
0
|
0
|
|
|
|
|
return $self->call_amt ? ($self->total_pot / $self->call_amt) : 0; |
174
|
|
|
|
|
|
|
} |
175
|
|
|
|
|
|
|
|
176
|
|
|
|
|
|
|
sub reset { |
177
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
178
|
|
|
|
|
|
|
#$self->game_over(0); |
179
|
0
|
|
|
|
|
|
$self->pot(0); |
180
|
0
|
|
|
|
|
|
$self->last_bet(0); |
181
|
0
|
|
|
|
|
|
$self->round(1); |
182
|
0
|
|
|
|
|
|
$self->community_cards( [] ); |
183
|
0
|
|
|
|
|
|
$self->game_count( $self->game_count + 1 ); |
184
|
0
|
|
|
|
|
|
for my $chair ( grep { defined $_ } @{ $self->chairs } ) { |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
185
|
0
|
|
|
|
|
|
$chair->reset; |
186
|
|
|
|
|
|
|
} |
187
|
|
|
|
|
|
|
} |
188
|
|
|
|
|
|
|
|
189
|
|
|
|
|
|
|
sub table_detail { |
190
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
191
|
|
|
|
|
|
|
return { |
192
|
0
|
|
|
|
|
|
table_id => $self->table_id, |
193
|
|
|
|
|
|
|
game_count => $self->game_count, |
194
|
|
|
|
|
|
|
chair_count => $self->chair_count, |
195
|
|
|
|
|
|
|
player_count => $self->player_count, |
196
|
|
|
|
|
|
|
round => $self->round, |
197
|
|
|
|
|
|
|
action => $self->action, |
198
|
|
|
|
|
|
|
pot => $self->pot, |
199
|
|
|
|
|
|
|
total_pot => $self->total_pot, |
200
|
|
|
|
|
|
|
pot_odds => $self->pot_odds, |
201
|
|
|
|
|
|
|
class => $self->class, |
202
|
|
|
|
|
|
|
game_over => $self->game_over, |
203
|
|
|
|
|
|
|
auto_start => $self->auto_start, |
204
|
|
|
|
|
|
|
time_bank => $self->time_bank, |
205
|
|
|
|
|
|
|
last_bet => $self->last_bet, |
206
|
|
|
|
|
|
|
last_act => $self->last_act, |
207
|
|
|
|
|
|
|
turn_clock => $self->turn_clock, |
208
|
|
|
|
|
|
|
community => $self->community, |
209
|
|
|
|
|
|
|
limit => $self->limit, |
210
|
|
|
|
|
|
|
max_raise => $self->max_raise, |
211
|
|
|
|
|
|
|
small_bet => $self->small_bet, |
212
|
|
|
|
|
|
|
pot_cap => $self->pot_cap, |
213
|
|
|
|
|
|
|
call_amt => $self->call_amt, |
214
|
|
|
|
|
|
|
director_id => $self->director_id, |
215
|
|
|
|
|
|
|
big_blind => $self->big_blind, |
216
|
|
|
|
|
|
|
small_blind => $self->small_blind, |
217
|
|
|
|
|
|
|
ante => $self->ante, |
218
|
|
|
|
|
|
|
}; |
219
|
|
|
|
|
|
|
} |
220
|
|
|
|
|
|
|
|
221
|
|
|
|
|
|
|
=head1 AUTHOR |
222
|
|
|
|
|
|
|
|
223
|
|
|
|
|
|
|
Nathaniel Graham, C |
224
|
|
|
|
|
|
|
|
225
|
|
|
|
|
|
|
=head1 BUGS |
226
|
|
|
|
|
|
|
|
227
|
|
|
|
|
|
|
Please report any bugs or feature requests directly to C |
228
|
|
|
|
|
|
|
|
229
|
|
|
|
|
|
|
=head1 LICENSE AND COPYRIGHT |
230
|
|
|
|
|
|
|
|
231
|
|
|
|
|
|
|
Copyright 2016 Nathaniel Graham. |
232
|
|
|
|
|
|
|
|
233
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it |
234
|
|
|
|
|
|
|
under the terms of the MIT license. |
235
|
|
|
|
|
|
|
|
236
|
|
|
|
|
|
|
=cut |
237
|
|
|
|
|
|
|
|
238
|
|
|
|
|
|
|
1; |