Extracting Pot Winners from Hand Histories in Multi-way Pots

For discussion of the Poker Mavens server module and other administration topics

Extracting Pot Winners from Hand Histories in Multi-way Pots

Postby Superderp » Thu Aug 22, 2013 10:32 am

At the end of every hand I use the callback feature to access the hand history and extract information like pot size, winner, and rake with php to then store in a database.

To do this I use the strrpos functions to find the last occurrence of strings like "wins Pot", "Rake(" and go through the characters around them until I find a non-alphanumeric character. This works fine in most cases but there's an issue with recording pots/winners in multi-way pots.

this is a snippet of how I extract one winner from the text:

$out = "hand history...";
$start = strrpos($out, $search) - 2;
//Starts at end of winners name and checks char's to it's left until a non-alphabetical or non-numeric character is found
for ( $i = $start ; true ; $i--){
$char = $out[$i];
if (ctype_alpha($char) == true || is_numeric($char) == true ) {
$winner .= $char;
}

else {
//Reverses order of string as it's backwards
$winner = strrev($winner);
break;
}
}



For every instance of "wins Pot" I could do the above to find the winner/pot size but what if the hand history looked something like this:

Blah
Blah
Blah Blah
Bill: Bill wins Pot (1000000000000) (Notice that this is chat)
blah
Joe wins Pot (200) with...
Bob wins pot (300) with...

I'd be able to record the legitimate pots/winners but this process would also treat Bill's chat like an actual pot. I know this is a pretty rare occurrence but the site has somewhat of a rakeback system which awards points when users win pots making this exploit quite abusable. Because of this i'm limited to only recording the last occurrence of "wins Pot" even when there are multiple winners.

If anyone can think of a way around this let me know :)
Superderp
 
Posts: 7
Joined: Wed Jul 17, 2013 7:15 pm

Re: Extracting Pot Winners from Hand Histories in Multi-way Pots

Postby Kent Briggs » Thu Aug 22, 2013 11:06 am

Superderp wrote:I'd be able to record the legitimate pots/winners but this process would also treat Bill's chat like an actual pot.


All chat lines have double quote marks in them so just search for that and ignore those lines.
Kent Briggs - [email protected]
Briggs Softworks - http://www.briggsoft.com
Kent Briggs
Site Admin
 
Posts: 3908
Joined: Wed Mar 19, 2008 8:47 pm


Return to Site Administration

Who is online

Users browsing this forum: No registered users and 6 guests

cron