Why not adopt me?
NAME
Games::Poker::OPP - Implements the Online Poker Protocol
SYNOPSIS
use Games::Poker::OPP;
my $poker = Games::Poker::OPP->new(
username => "Perlkibot",
password => "sekrit",
server => "chinook6.cs.ualberta.ca",
port => 55006
);
$poker->connect or die $@;
DESCRIPTION
This class implements the Online Poker Protocol as specified at http://games.cs.ualberta.ca/webgames/poker/bots.html. This implementation uses IO::Socket::INET
to do all the communication, but is designed to be subclassable for, e.g. POE.
METHODS
new
my $poker = Games::Poker::OPP->new(
username => "Perlkibot",
password => "sekrit",
server => "chinook6.cs.ualberta.ca",
port => 55006,
status => \&handle_update,
callback => \&decide_strategy
);
Prepares a new connection to a poker server. This doesn't actually make the connection yet; use connect
to do that.
You must supply a callback
which will be called when it is your turn to act; you may supply a status
callback which will be called during a game when something happens.
connect
Initiates a connection to the specified server. This is something you'll want to override if you're subclassing this module.
put ($data)
Sends $data
to the server.
get ($len)
Tries to retrieve $len
bytes of data from the server.
Again, things you'll override when inheriting.
joingame
Sends username/password credentials and joins the game. Returns 0 if the username/password was not accepted.
playgame
$self->playgame( )
Once you've signed into the server, the playgame
loop will receive status events from the server, update the internal game status object and call your callbacks.
state
Returns a Games::Poker::TexasHold'em
object representing the current state of play - the players involved, the pot, and so on. See Games::Poker::TexasHold'em for more information about how to use this.
EXAMPLES
See the included poker-client.pl as an example of how to use this module.
AUTHOR
Simon Cozens, <simon@dsl.easynet.co.uk>
COPYRIGHT AND LICENSE
Copyright 2003 by Simon Cozens
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.