Two Plus Two Older Archives  

Go Back   Two Plus Two Older Archives > Limit Texas Hold'em > Small Stakes Hold'em
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 06-11-2005, 06:58 PM
lockenvar lockenvar is offline
Junior Member
 
Join Date: Dec 2004
Posts: 9
Default GameTime Plus and Average Pot Size

I've never been able to figure out how to show average pot sizes for a room with GT+ so I took a few minutes and wrote this Win32 perl script that I put in the same directory as my hand histories and let it calculate the average pot size for me so I don't have to find my table in the party table list to see if my table's avg pot size has gone way down from when I sat down. It works with ActivePerl for Windows. You can do whatever you want with it. It seems to work ok on Party Hands.

Put it in the same dir as your hand histories and run:
perl avgpot.pl <sleep time>
e.g. to process hands every 5 minutes->
perl avgpot.pl 5
It won't process hand history files that haven't changed within the sleep interval. I'm not a programmer or anything so it may not be that well written but it may be of some use.



#AVG POT Calculator for use with Poker

$DEBUG=1;
$forever=1;

use Win32::File;
use Cwd 'abs_path';
use File::stat;

$workdir = abs_path();

system("cls");
print "\n\n";

do {
print "Working Directory: \n$workdir\n";
if ($ARGV[0] ne '')
{
#lets convert CLI argument to seconds
$sleep_time=$ARGV[0] * 60;

opendir(DIR,".");
@files = readdir(DIR);
closedir(DIR);
foreach $file_temp (@files)
{
$total_wins=0;
$total_won=0;
next if ($file_temp eq ".");
next if ($file_temp eq "..");
next if ($file_temp eq "avgpot.pl" || $file_temp eq "avgpot.pl.bak");
Win32::File::GetAttributes($file_temp, $attr);
next if ($attr ne 32);


$stats = stat($file_temp);
$modified_time=$stats->mtime;
if ($hash{$file_temp} != $modified_time) {$file_changed=1;} else {$file_changed=0;}
$hash{ $file_temp } = $modified_time;
#print $hash{$file_temp};

if ($file_changed)
{
#open file
open(list, $file_temp) or die "an error occured: $!";
@file_contents=<list>;
close (list);
foreach $temp_contents (@file_contents)
{
if ($temp_contents =~ /Table Table/)
{
$table = $temp_contents;
}
if ($temp_contents =~ /wins \$/)
{
@wins_temp = split(/\$/, $temp_contents);
@pot = split(/ /,@wins_temp[1]);
chomp(@pot[0]);
$cash_won=@pot[0];
$total_won = $total_won + $cash_won;
++$total_wins;
}
}
#next file in dir
if ($total_wins != 0) {$table_pot_avg = $total_won / $total_wins;}
$table_pot_avg = sprintf("%.2f", $table_pot_avg);
#fix up table name
$table_name_len=length($table);
$table=substr($table,6,$table_name_len);

if ($total_wins != 0) {print "\n$table";}
if ($total_wins != 0) {printf "AVG POT = \$$table_pot_avg on the last $total_wins hands\n";}
}
}
#no more files
print "\n\nWaiting for $ARGV[0] minutes to check for changed files...\n";
sleep($sleep_time);
system("cls");

}

else
{
#no arg entered...print syntax
print "\n\nSyntax: perl avgpot.pl <timer>\n";
#halt script
$forever=0;
}


}while ($forever);
Reply With Quote
  #2  
Old 06-11-2005, 09:10 PM
Tk79 Tk79 is offline
Member
 
Join Date: Oct 2004
Posts: 92
Default Re: GameTime Plus and Average Pot Size

????? explain
Reply With Quote
  #3  
Old 06-11-2005, 10:42 PM
lockenvar lockenvar is offline
Junior Member
 
Join Date: Dec 2004
Posts: 9
Default Re: GameTime Plus and Average Pot Size

I just like seeing the average pot size for each table I'm at and GameTime+ doesn't show this (that I can see). here's an example of the output after running perl avgpot.pl 5:

Working Directory:
D:/Program Files/PartyPoker/HandHistory/lockenvar/20050611

Table 32753 (Real Money)
AVG POT = $17.87 on the last 157 hands

Table 32176 (Real Money)
AVG POT = $22.38 on the last 75 hands

Table 32178 (Real Money)
AVG POT = $21.69 on the last 160 hands


Waiting for 5 minutes to check for changed files...

BTW...I tweaked it up a bit more and here is the result:


#AVG POT Calculator for use with Poker
$DEBUG=0;
$forever=1;

use Win32::File;
use Cwd 'abs_path';
use File::stat;

$workdir = abs_path();

system("cls");
print "\n\n";

do {
print "Working Directory: \n$workdir\n";
if ($ARGV[0] ne '')
{
#lets convert CLI argument to seconds
$sleep_time=$ARGV[0] * 60;

opendir(DIR,".");
@files = readdir(DIR);
closedir(DIR);
foreach $file_temp (@files)
{
$total_wins=0;
$total_won=0;
next if ($file_temp eq ".");
next if ($file_temp eq "..");
next if ($file_temp eq "avgpot.pl" || $file_temp eq "avgpot.pl.bak");
Win32::File::GetAttributes($file_temp, $attr);
next if ($attr ne 32);


$stats = stat($file_temp);
$modified_time=$stats->mtime;
if ($hash{$file_temp} != $modified_time) {$file_changed=1;} else {$file_changed=0;}
$hash{ $file_temp } = $modified_time;
#print $hash{$file_temp};

if ($file_changed)
{
#open file
open(list, $file_temp) or die "an error occured: $!";
@file_contents=<list>;
close (list);
foreach $temp_contents (@file_contents)
{
if ($temp_contents =~ /Table Table/)
{
$table = $temp_contents;
}
if ($temp_contents =~ /wins \$/ && $temp_contents !~ /The Progressive Bad Beat Jackpot has been hit/)
{
@wins_temp = split(/\$/, $temp_contents);
@pot = split(/ /,@wins_temp[1]);
chomp(@pot[0]);
$cash_won=@pot[0];
$total_won = $total_won + $cash_won;
++$total_wins;
if ($DEBUG==1) {print "$cash_won\t$total_wins\n";}
}
}
#next file in dir
if ($total_wins != 0) {$table_pot_avg = $total_won / $total_wins;}
$table_pot_avg = sprintf("%.2f", $table_pot_avg);
#fix up table name
$table_name_len=length($table);
$table=substr($table,6,$table_name_len);

if ($total_wins != 0) {print "\n$table";}
if ($total_wins != 0) {printf "AVG POT = \$$table_pot_avg on the last $total_wins hands\n";}
}
}
#no more files
print "\n\nWaiting for $ARGV[0] minutes to check for changed files...\n";
sleep($sleep_time);
system("cls");

}

else
{
#no arg entered...print syntax
print "\n\nSyntax: perl avgpot.pl <timer>\n";
#halt script
$forever=0;
}


}while ($forever);
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 02:56 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.