Open Side Menu Go to the Top
Register
Sklansky bucks calculator (php script) Sklansky bucks calculator (php script)

04-04-2007 , 09:03 PM
Also, I'll probably be of limited help in supporting this, but feel free to PM me anyway, and I'll do what I can.
Sklansky bucks calculator (php script) Quote
04-05-2007 , 12:19 AM
Soooooo, anyone with a pokenum walkthrough? I cant even find it through google.
Sklansky bucks calculator (php script) Quote
04-05-2007 , 12:29 AM
Yeah, sorry I can't be more helpful with that part. I got it running on linux with a fair amount of difficulty, I know it works on windows, and there may even be a pokenum.exe file floating out there.
Sklansky bucks calculator (php script) Quote
04-05-2007 , 12:39 AM
Phil,

Will your program support Omaha high?
Sklansky bucks calculator (php script) Quote
04-05-2007 , 01:35 AM
I'm working on adding pokenum. I have all of the source code, I just need to compile it on Windows. Having a little difficulty since I'm not using Vista. I'm not sure how much time I'll have either, as I have a ton of stuff going on in my life right now and have very little free time.
Sklansky bucks calculator (php script) Quote
04-05-2007 , 02:17 AM
Devil,

Yes, it does.

Wildzer, nice script. I didn't realize php was that powerful for local programming.
Sklansky bucks calculator (php script) Quote
04-05-2007 , 05:40 AM
Quote:
I'm working on adding pokenum. I have all of the source code, I just need to compile it on Windows
it's somewhere 4 download, not sure exactly where

http://download.gna.org/pokersource/...eval/examples/
Sklansky bucks calculator (php script) Quote
04-05-2007 , 07:42 AM
Quote:
Quote:
I'm working on adding pokenum. I have all of the source code, I just need to compile it on Windows
it's somewhere 4 download, not sure exactly where

http://download.gna.org/pokersource/...eval/examples/
Great find. I've been scouring all of these directories and couldnt find the executible anywhere! This should save me some time...
Sklansky bucks calculator (php script) Quote
04-05-2007 , 08:11 AM
Quote:
Quote:
I'm working on adding pokenum. I have all of the source code, I just need to compile it on Windows
it's somewhere 4 download, not sure exactly where

http://download.gna.org/pokersource/...eval/examples/
holy crap! I must've looked for that .exe file for hours. nice find ! This script's pretty much a piece of cake to run now.
Sklansky bucks calculator (php script) Quote
04-05-2007 , 10:51 AM
Finished product?
Sklansky bucks calculator (php script) Quote
04-05-2007 , 11:14 AM
Quote:
Quote:
Quote:
I'm working on adding pokenum. I have all of the source code, I just need to compile it on Windows
it's somewhere 4 download, not sure exactly where

http://download.gna.org/pokersource/...eval/examples/
holy crap! I must've looked for that .exe file for hours. nice find ! This script's pretty much a piece of cake to run now.
Help! I've downloaded php and copied that script into notepad and renamed it luck.php. Then opened the php program and put the location of luck.php into it. Nothing happens. Just moves onto the next line.

Now on my desktop the notepad file is now a php file, but when I double click it in opens php for a second and then closes without "spitting out" any info. Any idea where I'm going wrong.

This is an excellent idea btw. Respect.
Sklansky bucks calculator (php script) Quote
04-05-2007 , 11:27 AM
sounds like you've gotten reasonably far! Here's a quick tutorial that I hope everyone can use.

1. Go to http://www.apachefriends.org/en/xampp.html and download the windows installer. This is just an easy way to install php on your system.

2. Go to http://download.gna.org/pokersource/...eval/examples/ and download pokenum.exe

3. Copy the script I'm about to paste below into a text document, call it luck.php (keep it in the same folder as pokenum.exe).

4. Open up luck.php in notepad and change the variables at the top to match your settings (there are notes in the file to walk you through it, it's easy.

5. Open up your windows command line, easiest way is to go to Start->run and type "cmd"

6. cd to the directory where luck.php and pokenum are

7. type: "c:\Program Files\xampp\php\php.exe" luck.php"

8. Wait for it to finish (could take a while)

9. Bask in the glory of your earned Sklansky bucks.
Sklansky bucks calculator (php script) Quote
04-05-2007 , 11:29 AM
Here's a version of the script with a quick change to make it easier to use on windows systems. If you're on windows, use this instead of the code I pasted above.

Quote:

<?php
/*
ok, to use this script you need php installed. The easiest way to do this is to go to http://www.apachefriends.org/en/xampp.html
and download the windows installer. Instant php! Now you just need to edit the variables below (above the big line). Save this as luck.php

You can use the windows command line to run this script then. Just go to
start->run and type in cmd. When the windows comes up, type c:\Program Files\xampp\php\php.exe c:\path\to\luck.php
It'll spit out 3 numbers. The first number is the amount you won. The 2nd number is the amount you "should have" one
(sklansky bucks or whatever). The 3rd number is the total amount of money you put into these pots.
*/


//put your pokersite screen name here
$screen_name = "sceenname";

//put the stake string here (just edit the dollar amounts to match your stake
$stake_string = "($1.00/$2.00)";

//this is the date to begin with in pokertracker, it'll go from this date to the present.
$since_date = "2007-04-01";

//connection info - put all your postgres pt db connection info into these variables.
$db_name = "PTPGSQL1";
$host = "localhost";
$user = "postgres";
$password = "password";


//***************************************DON'T EDIT BELOW THIS POINT*********************************

$conn_string = "dbname=" . $db_name ." host=" . $host . " user=" . $user . " password=" . $password;
$conn = pg_connect($conn_string);
if(!$conn) {
echo("there was an error\n");
}

$query = "select hh.hand_history, gp.hole_card_1, gp.hole_card_2, gp2.hole_card_1, gp2.hole_card_2, g.flop_1, g.flop_2, g.flop_3, g.turn, g.river, gp.pre_flop_bet, gp.flop_bet, gp.turn_bet, gp.river_bet, gp.won_hand, g.pot, gp.total_won, g.game_number, gp.total_bet
from game g
join hand_histories hh on g.game_number = hh.game_number
join game_players gp on g.game_id = gp.game_id
join game_players gp2 on g.game_id = gp2.game_id
join players p on p.player_id = gp.player_id
join players p2 on p2.player_id = gp2.player_id
where p.screen_name = '" . $screen_name . "'
and p2.screen_name != '" . $screen_name . "'
and (gp.pre_flop_bet + gp.flop_bet + gp.turn_bet + gp.river_bet >= gp.chip_count
or gp2.pre_flop_bet + gp2.flop_bet + gp2.turn_bet + gp2.river_bet >= gp2.chip_count)
and gp2.went_to_showdown_n = 1
and gp.went_to_showdown_n = 1
and g.date_played >= '" . $since_date . "'
and hh.hand_history like '%" . $stake_string . "%'
order by g.game_number";


$result = pg_query ($conn, $query);
if(!$result) {
echo("An error occured.\n");
}
$a = 0;
while($row = pg_fetch_row($result)) {
if($last_game_number == $row[17]) {
// echo("\n skipping " . $last_game_number);
} else {
$a++;
$hh = $row[0];
$my_hole_card_1 = $row[1];
$my_hole_card_2 = $row[2];
$v_hole_card_1 = $row[3];
$v_hole_card_2 = $row[4];
$flop_1 = $row[5];
$flop_2 = $row[6];
$flop_3 = $row[7];
$turn = $row[8];
$river = $row[9];
$pre_flop_bet = $row[10];
$flop_bet = $row[11];
$turn_bet = $row[12];
$river_bet = $row[13];
$i_won_hand = $row[14];
$pot = $row[15];
$total_won = $row[16];
$last_game_number = $row[17];
$total_bet = $row[18];


$exec_string = "pokenum.exe -h " . $my_hole_card_1 . " " . $my_hole_card_2 . " - " . $v_hole_card_1 . " " . $v_hole_card_2;

if($flop_bet > 0 || $turn_bet > 0 || $river_bet > 0) {
$exec_string .= " -- " . $flop_1 . " " . $flop_2 . " " . $flop_3;
}

if($turn_bet >0 || $river_bet > 0) {
$exec_string .= " " . $turn;
}

if($river_bet > 0) {
$exec_string .= " " . $river;
}

unset($pokenum_output);
exec($exec_string, $pokenum_output);

unset($new_arr);

$line_arr = explode(" ", $pokenum_output[2]);
$arr_count = 0;
for($i=1;$i<count($line_arr);$i++) {
if(!$line_arr[$i] == "") {
$new_arr[$arr_count] = $line_arr[$i];
$arr_count++;
}
}

$sizeof_arr = sizeof($new_arr) - 1;
$ev = $new_arr[$sizeof_arr];
$equity = $ev * $pot;

$all_won += $total_won;
$all_equity += $equity;
$all_bet += $total_bet;
$total_ev += $ev;

}
}
echo("\n" . $a . " hands played with an average ev of " . $total_ev / $a);
echo("\nwon: " . $all_won);
echo("\nequity: " . $all_equity);
echo("\n total bet: " . $all_bet . "\n");

?>

Sklansky bucks calculator (php script) Quote
04-05-2007 , 11:45 AM
Anyone getting this to work?

I followed all the steps above and edited the screen name, stake, date and password. I also put the pokenum.exe in the same directory as the luck.php script.
This is what I get with the script for Linux and the recently posted one for Windows:

Fatal error: Call to undefinded function pg_connect() in C:\path\luck.php on line 32
Sklansky bucks calculator (php script) Quote
04-05-2007 , 11:58 AM
Quote:
Anyone getting this to work?

I followed all the steps above and edited the screen name, stake, date and password. I also put the pokenum.exe in the same directory as the luck.php script.
This is what I get with the script for Linux and the recently posted one for Windows:

Fatal error: Call to undefinded function pg_connect() in C:\path\luck.php on line 32
Almost there! I forgot that postgres support is disabled in xampp by default. This is easy.

1. Open up c:\Program Files\xampp\php\php.ini in notepad or something similar.

2. Search for this line:
Quote:
extension=php_pdo_pgsql.dll
3. Delete the semicolon at the beginning of the line.

4. Do the same thing for this line:
Quote:
extension=php_pgsql.dll
5. Save the file.
Sklansky bucks calculator (php script) Quote
04-05-2007 , 01:41 PM
thanks a lot, it works like a charm now
Sklansky bucks calculator (php script) Quote
04-05-2007 , 02:33 PM
This is excellent. Any ideas how to automate this so I can results results in a couple of clicks?
Sklansky bucks calculator (php script) Quote
04-05-2007 , 02:38 PM
Well, once you get it all set up, all you need to do is change the date if you feel like it and type the c:\Program Files\xampp\php\php.exe luck.php line. pretty simple.
Sklansky bucks calculator (php script) Quote
04-05-2007 , 03:14 PM
I keep getting the following message "Warning: Division by zero in luck.php on line 125"
Sklansky bucks calculator (php script) Quote
04-05-2007 , 03:29 PM
Quote:
I keep getting the following message "Warning: Division by zero in luck.php on line 125"
The only way you would get that is if you're not getting any qualifying hands from the db. Check the variables at the top, make sure everything is set correctly.
Sklansky bucks calculator (php script) Quote
04-05-2007 , 03:44 PM
Where do I get the info for my pokertracker database to put into the script having trouble finding where each variable is located and can be modified in pokertracker? Where is the username and password info? Do I have to convert the database to SQL to use the script? Have got everything else setup.
Sklansky bucks calculator (php script) Quote
04-05-2007 , 03:46 PM
Thanks for the reply wildzer0... my variables are:

$stake_string = "0.50/1.00";

$since_date = "2007-04-01";

$db_name = "PTPGSQL1";
$host = "localhost";
$user = "postgres";
$password = "1234";

Are these in correct format? (stake)

Checked them over few times before posting... many thanks for helping me out.
Sklansky bucks calculator (php script) Quote
04-05-2007 , 04:03 PM
Quote:
Where do I get the info for my pokertracker database to put into the script having trouble finding where each variable is located and can be modified in pokertracker? Where is the username and password info? Do I have to convert the database to SQL to use the script? Have got everything else setup.
Nevermind figured it all out.
Sklansky bucks calculator (php script) Quote
04-05-2007 , 04:15 PM
Your stake_string is wrong. Should be ($0.50/$1.00)
Sklansky bucks calculator (php script) Quote
04-05-2007 , 04:49 PM
Do we need to open the php application at all? Someone mentioned telling php where the luck.php file was located and I have no idea what that means or how to do it. Another thing, where should pokenum and luck.php be saved? I have them in a folder on my desktop and that doesn't seem to be working. Computer illiterate here lol. Oh and the luck.php is just a notepad file, does it need to be converted or something?
Sklansky bucks calculator (php script) Quote

      
m