Tag Archives: Poker

Converting Poker Stars Play Money Logs to Real Money

I wanted to use Poker Tracker to keep track of my stats when playing at the play money tables of Poker Stars. Poker Tracker doesn’t support the play money tables.

I wrote some Perl to convert the the lots from the play money format into the real money format.

#!/usr/bin/perl
use strict;
use Cwd;
use File::Find;
 
my $some_dir = "Z:\\HandHistory";
my $startDir = &Cwd::cwd();
find(\&processFile, $some_dir);
exit;
 
sub processFile {
    shift;
    return if not /\.txt$/;
    my $inFileName = $_;
    my $infile = "$startDir/$File::Find::name";
    my $outfile = "$startDir/outHands/$inFileName.$$.converted.txt";
    open (inFILE, "<$infile") or die "can't open in file!: #$infile# ($!)";
    open (outFILE, ">$outfile") or die "can't open out file!:#$outfile# ($!)";
    my @players;
    while(<inFILE>) {
        chomp;
        @players = () if (s/^(PokerStars Game .*\()(\d+)\/(\d*)(\).*)$/\1\$\2.00\/\$\3.00\4/);
        push(@players, $1) if (/^Seat [\d+]: (.*) \(\d+ in chips\)/);
        foreach my $key (@players) {
            my $value = $key;
            $value =~ s/\s+/_/;
            ($value = $1) =~ s/($1)/_\1/ if ($key =~ /^(\d+)$/);
            s/$key/$value/;
        }
        s/([\( ])(\d+)([\) \.])/\1\$\2.00\3/g;
        s/\(Play Money\) //g;
 
        s/^\s+//;
        s/\s+$//;
        print outFILE "$_\n";
    }
    close(inFILE);
    close(outFILE);
}