HHprob Posted October 30, 2009 Share Posted October 30, 2009 Hi, I have run into a tricky problem. I'm pretty new to PHP but anyhow I took a shot with my little project - a hand history converter for pot limit omaha. The thing is that i need to convert text file contents into another looking contents (example below). I've already got some job done but the main problem occurs when I need to get this converted: Dealing Flop [9d 2h 5s] player1 checks player2 checks player3 bets $3 // So, player3 first bets $3 player1 raises to $12 // player1 raises to $12 player2 calls $12 player3 calls $12 //player3 now calls the player1's raise ($9 more), and it's says $12 Dealing Turn [Qd] ...into this kind of format: Dealt to Hero [As Js Ad Jh] player1 bets $14 player2 calls $14 player3 raises to $62 //here player 3 raises to $62 ($48 more) player1 calls $48 //here player 1 calls a raise, and it says $48, not the $62 as it would in example above player2 calls $48 *** FLOP *** [Ah 5c 7d] I've tried to figure out how to proceed with this but I have just one complicated idea that goes something like the following (didn't write the code in php but in a way I see it could be done, sorry about that: if ("playerX bets $x" && "playerY raises to $y" && ("playerX calls $z" && "$z == $y")) { then $z == $z-$x; } Could someone please help me with this. PHP is the way for me to do it. Here's the full examples of those 2 hand history files. Original: Seat 1: player1 - $34.50 Seat 2: player2 - $144.75 Seat 3: player3 - $373.65 Seat 4: player4 - $48.05 Seat 5: player5 - $97 Seat 6: player6 - $285.90 Moving Button to seat 2 player3 posts small blind ($0.50) player4 posts big blind ($1) Shuffling Deck Dealing Cards Dealing [9c 6h Ad 3s] to player4 player3 cheers. player5 folds player6 calls $1 player1 folds player2 raises to $3 player3 calls $3 player4 folds player6 calls $3 Dealing Flop [Th As Ks] player3 checks player6 checks player2 bets $8 player3 folds player6 folds Taking Rake of $0.50 from pot 1 player2 doesn't show player2 wins $9.50 Seat 1: player1 - $34.50 Seat 2: player2 - $151.25 Seat 3: player3 - $370.65 Seat 4: player4 - $47.05 Seat 5: player5 - $97 Seat 6: player6 - $282.90 Seat 1: player1 - $34.50 Seat 2: player2 - $151.25 Seat 3: player3 - $370.65 Seat 4: player4 - $47.05 Seat 5: player5 - $97 Seat 6: player6 - $282.90 Moving Button to seat 3 player4 posts small blind ($0.50) player5 posts big blind ($1) Shuffling Deck Dealing Cards Dealing [Ad 2c Qc 9s] to player4 player6 folds player1 folds player2 folds player3 calls $1 player4 calls $1 player5 checks Dealing Flop [9d 2h 5s] player4 checks player5 checks player3 bets $3 player4 raises to $12 player5 calls $12 player3 calls $12 Dealing Turn [Qd] player4 bets $34.05 (all-in) player2: bye bye summer, bye bye fall, hello WINTER! O M Jeeesus player5 calls $34.05 player3 folds player4 shows [Ad 2c Qc 9s] player5 shows [4h 6c 7d 9h] Dealing River [6h] Taking Rake of $3 from pot 1 player2 has received 4 additional seconds in the time bank [20 total seconds] player4 has Two Pairs: Queens, 9s player4 wins $104.10 with: Two Pairs: Queens, 9s Seat 1: player1 - $34.50 Seat 2: player2 - $151.25 Seat 3: player3 - $357.65 Seat 4: player4 - $104.10 Seat 5: player5 - $49.95 Seat 6: player6 - $282.90 ...And the format I want to have conveterted to: Full Tilt Poker Game #11921976757: Table Taste (6 max) - $2/$4 - Pot Limit Omaha Hi - 19:42:02 ET - 2009/04/28 Seat 1: TryToKeepItUp ($929.80) Seat 2: StarEeg4life ($400) Seat 3: hamking ($454) Seat 4: GodlikeRoy ($79.20) Seat 5: Hero ($750.80) Seat 6: Crank14 ($497.50) Crank14 posts the small blind of $2 TryToKeepItUp posts the big blind of $4 The button is in seat #5 *** HOLE CARDS *** Dealt to Hero [As Js Ad Jh] StarEeg4life raises to $14 hamking calls $14 GodlikeRoy folds Hero raises to $62 Crank14 folds TryToKeepItUp folds StarEeg4life folds StarEeg4life adds $14 hamking has 15 seconds left to act hamking calls $48 *** FLOP *** [Ah 5c 7d] hamking checks Hero bets $109 hamking calls $109 *** TURN *** [Ah 5c 7d] [Ks] hamking checks Hero has 15 seconds left to act Hero bets $283 hamking calls $283, and is all in Hero shows [As Js Ad Jh] hamking shows [Kh 6d 9h Kc] *** RIVER *** [Ah 5c 7d Ks] [8c] Hero shows three of a kind, Aces hamking shows a straight, Nine high hamking wins the pot ($925) with a straight, Nine high Hero adds $103.20 *** SUMMARY *** Total pot $928 | Rake $3 Board: [Ah 5c 7d Ks 8c] Seat 1: TryToKeepItUp (big blind) folded before the Flop Seat 2: StarEeg4life folded before the Flop Seat 3: hamking showed [Kh 6d 9h Kc] and won ($925) with a straight, Nine high Seat 4: GodlikeRoy didn't bet (folded) Seat 5: Hero (button) showed [As Js Ad Jh] and lost with three of a kind, Aces Seat 6: Crank14 (small blind) folded before the Flop Full Tilt Poker Game #13473584888: Table Cremona (6 max) - $2/$4 - Pot Limit Omaha Hi - 17:28:54 ET - 2009/07/18 Seat 1: Hero ($400) Seat 2: zcooke ($384), is sitting out Seat 3: bollax ($1,123.70) Seat 4: diazepamR ($429) Seat 5: WhiteRice1 ($716.80) Seat 6: Lay Low ($611.10) bollax posts the small blind of $2 diazepamR posts the big blind of $4 The button is in seat #1 *** HOLE CARDS *** Dealt to Hero [7s Kh 9s Th] WhiteRice1 folds Lay Low folds Hero raises to $14 bollax raises to $40 diazepamR calls $36 Hero calls $26 *** FLOP *** [8d 6c 9d] bollax bets $120 diazepamR calls $120 Hero raises to $360, and is all in bollax raises to $600 diazepamR has 15 seconds left to act diazepamR has requested TIME diazepamR calls $269, and is all in bollax shows [5h 5d 7h 7c] diazepamR shows [8h Ks Qs 9h] Hero shows [7s Kh 9s Th] Uncalled bet of $211 returned to bollax *** TURN *** [8d 6c 9d] [Js] *** RIVER *** [8d 6c 9d Js] [8c] bollax shows a straight, Nine high diazepamR shows a full house, Eights full of Nines diazepamR wins the side pot ($58) with a full house, Eights full of Nines Hero shows a straight, Jack high diazepamR wins the main pot ($1,197) with a full house, Eights full of Nines Hero adds $400 *** SUMMARY *** Total pot $1,258 Main pot $1,200. Side pot $58. | Rake $3 Board: [8d 6c 9d Js 8c] Seat 1: Hero (button) showed [7s Kh 9s Th] and lost with a straight, Jack high Seat 2: zcooke is sitting out Seat 3: bollax (small blind) showed [5h 5d 7h 7c] and lost with a straight, Nine high Seat 4: diazepamR (big blind) showed [8h Ks Qs 9h] and won ($1,255) with a full house, Eights full of Nines Seat 5: WhiteRice1 didn't bet (folded) Seat 6: Lay Low didn't bet (folded) [pre]Any help what so ever would be appriciated![/pre][pre]Thanks in advance,[/pre][pre]Mika[/pre] [/td] Quote Link to comment https://forums.phpfreaks.com/topic/179619-regex-to-parse-string-and-compare-variables-in-it/ Share on other sites More sharing options...
trq Posted October 30, 2009 Share Posted October 30, 2009 Any reason you've made the font so small nobody can read your post? Quote Link to comment https://forums.phpfreaks.com/topic/179619-regex-to-parse-string-and-compare-variables-in-it/#findComment-947766 Share on other sites More sharing options...
HHprob Posted October 30, 2009 Author Share Posted October 30, 2009 Any reason you've made the font so small nobody can read your post? just to trick human eyes... keep it shorter than it really is. can't see any button to edit the post. Quote Link to comment https://forums.phpfreaks.com/topic/179619-regex-to-parse-string-and-compare-variables-in-it/#findComment-947770 Share on other sites More sharing options...
HHprob Posted October 30, 2009 Author Share Posted October 30, 2009 Any reason you've made the font so small nobody can read your post? just to trick human eyes... keep it shorter than it really is. can't see any button to edit the post. hand histoy file attached. [attachment deleted by admin] Quote Link to comment https://forums.phpfreaks.com/topic/179619-regex-to-parse-string-and-compare-variables-in-it/#findComment-947775 Share on other sites More sharing options...
cags Posted October 30, 2009 Share Posted October 30, 2009 I could read that text fine, I'm just not entirely sure what you wish to do. Can you be more specific, I.E. "I want a row that looks like $a to look like $b". The two example you gave obviously used different data, which is not ideal, they are also fairly long and contain large sections seemingly in the same structure. Quote Link to comment https://forums.phpfreaks.com/topic/179619-regex-to-parse-string-and-compare-variables-in-it/#findComment-947786 Share on other sites More sharing options...
HHprob Posted November 1, 2009 Author Share Posted November 1, 2009 I'm sorry I didnt explain it clearly. The thing i want (and what seems to be a problem for me) is the following: Dealing Flop [9d 2h 5s] player1 checks player2 checks player3 bets $3 // So, player3 first bets $3 player1 raises to $12 // player1 raises to $12 player2 calls $12 player3 calls $12 //player3 now calls the player1's raise ($9 more), and it's says $12 which is the amount of last raise, that is the total sum of money put into pot Dealing Turn [Qd] so, that "player3 calls $12" needs to be converted to "player3 calls $9" - that is $12-$3=$9 (the last raise minus the last raise/bet/call from the player who WILL call that last raise). This how it should look after conversion: Dealing Flop [9d 2h 5s] player1 checks player2 checks player3 bets $3 player1 raises to $12 player2 calls $12 //player2 calls the whole $12 because he hasn't put any money into the pot yet player3 calls $9 //player3 now calls the player1's raise that is $9 more to his own first bet Dealing Turn [Qd] one more example: Dealing Flop [9d 2h 5s] player1 bets $5.50 player2 raises to $20 player3 raises to $40 player1 calls $40 player2 calls $40 Dealing Turn [Qd] needs to be converted to: Dealing Flop [9d 2h 5s] player1 bets $5.50 player2 raises to $20 player3 raises to $40 player1 calls $34.50 //$40 - $5.50 player2 calls $20 //$40 - $20 Dealing Turn [Qd] Is the proper way to proceed to first split the text file so that the array contains every hand (that is array[0] contains first hand dealt and array[1] contains second hand dealt -- and i dont mean players hand but the whole hand that includes all the players hand and actions on all streets and who wins the pot etc) ...and then propably somehow put those amounts of bets, raises and calls to variable and then compare them and act accordingly. And not to make this too easy, player1, player2 etc are actually usernames that can contain any character but not a space or some special characters and the pot can be contested by between 2 and 9 players. As i think, the thing needs to be done here is to search the last raise someone does and then compare the players that calls that last raise and how much money they have put into the pot before. Or something like that. I'm lost - and struggling with trying to explain this in english... sorry this so hard for a finn! :'( Quote Link to comment https://forums.phpfreaks.com/topic/179619-regex-to-parse-string-and-compare-variables-in-it/#findComment-948720 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.