Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: parse Omaha Hi/Lo hands #3

Merged
merged 1 commit into from
Nov 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -271,11 +271,11 @@ The value returned is represented as a [`Site`](https://github.com/poker-apprent

This package currently supports the following poker sites & networks:

| Site | Network | Cash Games | Tournaments | Hold'em | Omaha | Omaha-8 | Stud | Currencies |
| -------- | -------- | :--------: | :---------: | :-----: | :-----: | :------: | :--: | ---------- |
| Bodog | Ignition | ✅ | ❌ | ✅ | ✅ | ❌ | N/A | USD |
| Bovada | Ignition | ✅ | ❌ | ✅ | ✅ | ❌ | N/A | USD |
| Ignition | Ignition | ✅ | ❌ | ✅ | ✅ | ❌ | N/A | USD |
| Site | Network | Cash Games | Tournaments | Hold'em | Omaha | Omaha-8 | Stud | Currencies |
| -------- | -------- | :--------: | :---------: | :-----: | :-----: | :-----: | :--: | ---------- |
| Bodog | Ignition | ✅ | ❌ | ✅ | ✅ | ✅ | N/A | USD |
| Bovada | Ignition | ✅ | ❌ | ✅ | ✅ | ✅ | N/A | USD |
| Ignition | Ignition | ✅ | ❌ | ✅ | ✅ | ✅ | N/A | USD |

The parser is built in a way that it is relatively straightforward to extend with new poker sites. The main thing that is missing for this to happen is a combination of sample hand histories to implement against & time.

Expand Down
70 changes: 70 additions & 0 deletions src/__fixtures__/hands/bovada.ts
Original file line number Diff line number Diff line change
Expand Up @@ -385,6 +385,76 @@ Seat+4: Small Blind Folded on the RIVER
Seat+5: Big Blind $4.06 [Does not show]
Seat+6: UTG Folded before the FLOP`;

export const HAND_OMAHA_HILO_HIGH_AND_LOW = `Bovada Hand #4304661864 TBL#26953916 OMAHA HiLo Pot Limit - 2022-06-26 16:46:42
Seat 1: Big Blind ($6.84 in chips)
Seat 4: Dealer [ME] ($25.60 in chips)
Dealer [ME] : Set dealer [4]
Dealer [ME] : Small Blind $0.10
Big Blind : Big blind $0.25
*** HOLE CARDS ***
Big Blind : Card dealt to a spot [Kh Kc Ks Th]
Dealer [ME] : Card dealt to a spot [Td Ad As 4c]
Dealer [ME] : Raises $0.65 to $0.75
Big Blind : Calls $0.50
*** FLOP *** [9d 2c 6h]
Big Blind : Checks
Dealer [ME] : Bets $1.43
Big Blind : Calls $1.43
*** TURN *** [9d 2c 6h] [3h]
Big Blind : Bets $4.36
Dealer [ME] : Raises $8.72 to $8.72
Big Blind : All-in $0.30
Dealer [ME] : Return uncalled portion of bet $4.06
*** RIVER *** [9d 2c 6h 3h] [3c]
Big Blind : Showdown [Kh Ks 9d 3h 3c] (Two pair)
Dealer [ME] : Showdown [Ad As 9d 3h 3c Ad 4c 2c 6h 3h] (Two pair)
Dealer [ME] : Hand result $13.18
Big Blind : Seat sit out
Big Blind : Seat stand
Big Blind : Table leave user
Dealer [ME] : Seat stand
Dealer [ME] : Table leave user
Table enter user
Seat sit down
Table deposit $25
Seat stand
Table leave user
*** SUMMARY ***
Total Pot($13.68)
Board [9d 2c 6h 3h 3c]
Seat+1: Big Blind lost with Two pair [Kh Kc Ks Th-Kh Ks 9d 3h 3c]
Seat+4: Dealer HI $6.59 with Two pair [Td Ad As 4c-Ad As 9d 3h 3c] LO $6.59 [Td Ad As 4c-Ad 4c 2c 6h 3h]`;

export const HAND_OMAHA_HILO_HIGH_ONLY = `Bovada Hand #4304661627 TBL#26953916 OMAHA HiLo Pot Limit - 2022-06-26 16:46:04
Seat 1: Dealer ($7.50 in chips)
Seat 4: Big Blind [ME] ($25 in chips)
Dealer : Set dealer [1]
Dealer : Small Blind $0.10
Big Blind [ME] : Big blind $0.25
*** HOLE CARDS ***
Dealer : Card dealt to a spot [As 9d 6h Jd]
Big Blind [ME] : Card dealt to a spot [Kd Js 6c Jc]
Dealer : Calls $0.15
Big Blind [ME] : Checks
*** FLOP *** [Kc 9h Ks]
Big Blind [ME] : Checks
Dealer : Checks
*** TURN *** [Kc 9h Ks] [4h]
Big Blind [ME] : Checks
Dealer : Bets $0.41
Big Blind [ME] : Calls $0.41
*** RIVER *** [Kc 9h Ks 4h] [Th]
Big Blind [ME] : Checks
Dealer : Checks
Big Blind [ME] : Showdown [Kd Js Kc Ks Th] (Three of a kind)
Dealer : Mucks [As 9d 6h Jd] (Two pair)
Big Blind [ME] : Hand result $1.26
*** SUMMARY ***
Total Pot($1.32)
Board [Kc 9h Ks 4h Th]
Seat+1: Dealer [Mucked] [As 9d 6h Jd ]
Seat+4: Big Blind HI $1.26 with Three of a kind [Kd Js 6c Jc-Kd Js Kc Ks Th]`;

export const HAND_STRAIGHT_FLUSH = `Bovada Hand #4296950465 TBL#26829077 OMAHA Pot Limit - 2022-06-10 12:42:20
Seat 1: Small Blind ($152.70 in chips)
Seat 2: Big Blind [ME] ($92 in chips)
Expand Down
11 changes: 8 additions & 3 deletions src/grammar/Ignition.g4
Original file line number Diff line number Diff line change
Expand Up @@ -58,16 +58,18 @@ lineActionSummary:
'Folded' ('before'|'on') 'the' STREET
| chipCount? '[Does not show]'
| '[Mucked]' hand
| chipCount 'with' handStrength (hand | handAndBoard)
| 'lost with' handStrength (hand | handAndBoard)
| winHighResult
| 'HI' winHighResult ('LO' winLowResult)?
| 'LO' winLowResult
| loseResult
);

// parser rules
handNumber : INT;
seatNumber : INT;
timestamp : INT '-' INT '-' INT INT ':' INT ':' INT;
site : 'Bodog' | 'Bovada' | 'Ignition';
variant : 'HOLDEM' | 'OMAHA' | 'HOLDEMZonePoker' | 'OMAHAZonePoker';
variant : 'HOLDEM' | 'OMAHA' | 'OMAHA HiLo' | 'HOLDEMZonePoker' | 'OMAHAZonePoker';
bettingStructure : 'No Limit' | 'Pot Limit' | 'Limit';
fastFold : FASTFOLD;
position : 'Small Blind' | 'Big Blind' | 'UTG' | 'UTG+1' | 'UTG+2' | 'Dealer';
Expand All @@ -90,6 +92,9 @@ actionAllIn : 'All-in' chipCount;
actionAllInRaise : 'All-in' '(raise)' chipCount 'to' chipCount;
forcedActionReason : '(' ~')'* ')';
showdownAction: 'Showdown' | 'Mucks';
winHighResult: chipCount 'with' handStrength (hand | handAndBoard);
winLowResult : chipCount (hand | handAndBoard);
loseResult : 'lost with' handStrength (hand | handAndBoard);

// lexer rules
ME : '[ME]';
Expand Down
2 changes: 1 addition & 1 deletion src/grammar/Site.g4
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ siteBovada: bovadaSite 'Hand' '#' INT bovadaFastFold? ('TBL#' | 'ID#') INT bovad
// lexer rules for individual sites & networks
bovadaSite: 'Bodog' | 'Bovada' | 'Ignition';
bovadaFastFold: 'Zone Poker';
bovadaVariant: 'HOLDEM' | 'OMAHA' | 'HOLDEMZonePoker' | 'OMAHAZonePoker';
bovadaVariant: 'HOLDEM' | 'OMAHA' | 'OMAHA HiLo' | 'HOLDEMZonePoker' | 'OMAHAZonePoker';
bovadaBettingStructure: 'No Limit' | 'Pot Limit' | 'Limit';
bovadaTimestamp: INT '-' INT '-' INT INT ':' INT ':' INT;

Expand Down
2 changes: 2 additions & 0 deletions src/networks/ignition/IgnitionHandHistoryVisitor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ const getVariant = (ctx: VariantContext): Variant => {
case 'OMAHA':
case 'OMAHAZonePoker':
return 'omaha';
case 'OMAHA HiLo':
return 'omaha-8';
default:
throw new Error(`Unexpected variant: "${ctx.text}"`);
}
Expand Down
Loading