| 1 | use strict; | ||
| 2 | $|=1; | ||
| 3 | use Games::Poker::OPP; | ||
| 4 | my ($username, $password) = @ARGV; | ||
| 5 | my $opp = new Games::Poker::OPP ( | ||
| 6 | username => $username, | ||
| 7 | password => $password, | ||
| 8 | callback => sub { | ||
| 9 | my $game = shift->state(); | ||
| 10 | print $game->status; | ||
| 11 | print "Hole cards: ", $game->hole, "\n"; | ||
| 12 | print "Board cards: ", $game->board, "\n"; | ||
| 13 | print "[F]old, [C]all/check [B]et/[R]aise\n"; | ||
| 14 | print "Your turn: "; | ||
| 15 | my $action = <STDIN>; | ||
| 16 | if ($action =~ /f/i) { $action = FOLD; } | ||
| 17 | elsif ($action =~ /[br]/i) { $action = RAISE; } | ||
| 18 | else { $action = CALL; } | ||
| 19 | return $action; | ||
| 20 | }, | ||
| 21 | status => sub { | ||
| 22 | my ($self, $cmd, @stuff) = @_; | ||
| 23 | if ($cmd == CHATTER || $cmd == INFORMATION) { | ||
| 24 | print @stuff, "\n"; | ||
| 25 | return; | ||
| 26 | } | ||
| 27 | return if $cmd == FOLD || $cmd == RAISE || $cmd == CALL | ||
| 28 | || $cmd == BLIND; | ||
| 29 | my $game = $self->state; | ||
| 30 | return unless $game; | ||
| 31 | print "\n---\n"; | ||
| 32 | print $game->status; | ||
| 33 | print "Hole cards: ", $game->hole, "\n"; | ||
| 34 | print "Board cards: ", $game->board, "\n"; | ||
| 35 | print "---\n"; | ||
| 36 | } | ||
| 37 | ); | ||
| 38 | |||
| 39 | print "Connecting...\n"; | ||
| 40 | $opp->connect; | ||
| 41 | print "Authorising...\n"; | ||
| 42 | die "Authorization failed\n" unless $opp->joingame; | ||
| 43 | print "Entering room.\n"; | ||
| 44 | $opp->playgame |