The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Poker::Robot - base class for building Mojo Poker poker robots

VERSION

Version 0.02

SYNOPSIS

    package Poker::Robot::Mybot;
    use Moo;
    
    # Poker::Robot::Random shows a working example
    extends 'Poker::Robot::Random';

    # override default method 
    sub move {
      # move selection logic goes here
    }

    # and elsewhere in a script ...
    use Poker::Robot::Mybot;

    # Note: you must pick a unique username!
    $robot = Poker::Robot::Mybot->new(
      websocket => 'wss://localhost:443/websocket',
      username => 'Mybot',  
      ring_ids => [ 1 ], 
    );

    $robot->connect;

INTRODUCTION

Handlers are automatically executed at appropriate stages of the game, allowing your bot to run on autopilot. By default, these handlers return legal but essentially random values. Your job is to override them in your subclass with something that makes more sense. Poker::Robot::Random shows a working example.

SERVERS

Download and install Mojo Poker to set up your own poker server. This is where you can deploy your bot once it is ready and have it compete against other bots and humans in real-time.

LOGGING

To see what your bot is doing, do a tail -f on robot.log

ATTRIBUTES

websocket

Websocket address of the test server. Default is wss://localhost/websocket

ring_ids

Required. Ids of ring games to join. Before setting this attribute, bring up the test site on your browser to see which tables have open seats.

HANDLERS

The following handlers can be overriden in your subclass with custom code for you robot. At some point I'll get around to documenting this better, but this will have to do for now.

SERVER CODES

    guest_login     
    login_snap   
    ring_snap   
    tour_snap        
    player_snap     
    table_snap       
    message_snap     
    table_update    
    player_update    
    login_update     
    new_game         
    end_game         
    deal_hole        
    begin_new_round  
    begin_new_action 
    deal_community 
    showdown       
    high_winner    
    low_winner     
    move_button    
    forced_logout  

NOTIFICATION CODES

    notify_login        
    notify_update_login 
    notify_logout       
    notify_create_ring  
    notify_join_table   
    notify_unjoin_table 
    notify_post         
    notify_bet          
    notify_check        
    notify_fold         
    notify_discard      
    notify_draw         
    notify_credit_chips 
    notify_table_chips  
    notify_lobby_update
    notify_message    
    notify_pick_game    
    notify_lr_update   

RESPONSE CODES

    join_ring_res   
    unjoin_ring_res 
    watch_table_res 
    unwatch_table_res
    login_res         
    logout_res        
    register_res      
    bet_res           
    check_res         
    fold_res          
    discard_res       
    draw_res         
    pick_game_res     
    reload_res 

REQUEST CODES

    join_ring
    unjoin_ring
    watch_table
    unwatch_table
    login
    logout
    register
    bet      
    check      
    fold          
    discard       
    draw        
    pick_game
    reload 

AUTHOR

Nathaniel Graham, ngraham@cpan.org

BUGS

Please report any bugs or feature requests directly to ngraham@cpan.org

LICENSE AND COPYRIGHT

Copyright 2016 Nathaniel Graham.

This program is free software; you can redistribute it and/or modify it under the terms of the MIT license.