Games::Poker::OPP - Implements the Online Poker Protocol
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 $@;
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.
IO::Socket::INET
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.
connect
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.
callback
status
Initiates a connection to the specified server. This is something you'll want to override if you're subclassing this module.
Sends $data to the server.
$data
Tries to retrieve $len bytes of data from the server.
$len
Again, things you'll override when inheriting.
Sends username/password credentials and joins the game. Returns 0 if the username/password was not accepted.
$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.
playgame
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.
Games::Poker::TexasHold'em
See the included poker-client.pl as an example of how to use this module.
Simon Cozens, <simon@dsl.easynet.co.uk>
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.
To install Games::Poker::OPP, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Games::Poker::OPP
CPAN shell
perl -MCPAN -e shell install Games::Poker::OPP
For more information on module installation, please visit the detailed CPAN module installation guide.