I run a poker trainer, and the most requested feature was "show me my mistakes in real games". That means reading hand history files, the plain text logs poker sites write for every hand. I wanted to do it without uploading anyone's files, so everything below runs in the browser.
What a hand history looks like
Each hand is a block of text: a header with the hand id, stakes and date, the seats with stacks, then actions street by street, then the summary. PokerStars and GGPoker are close, but not identical. GGPoker hides opponents' cards unless they reach showdown, tournament headers carry the level and ante, and some rooms post a big blind ante as a single line.
The approach that worked
- Split the file into hands by the header line, not by blank lines. The header is the one thing every hand reliably starts with.
- Parse seats first and build a map from player name to seat. Names can contain spaces and odd characters, so anchor the regex on the stack in parentheses at the end of the seat line instead of splitting on the first colon.
- Convert everything to big blinds right away. Tournaments use chips with growing blinds, cash games use money, and comparing a decision across hands only makes sense in BB.
- Put antes into the pot before the first action. It changes pot odds more than people expect, especially at 10 BB.
- Skip what you can't model and say why. Heads-up, run it twice and straddles are skipped with a reason shown to the user, which is better than a silently wrong verdict.
Equity without a server
Postflop equity is a Monte Carlo run against an opponent range that narrows as they act: preflop raise, call, bet, check. About 1,500 iterations per spot are enough for the rough verdicts a learner needs, and it stays fast on a phone. For short stacked tournament spots the review switches to Nash push/fold charts instead.
What I'd do differently
Write the fixture files first. Formats differ in tiny ways (currency symbols, thousands separators, how antes are posted), and a test per format caught more bugs than anything else.
You can try it on demo hands with a free account: 3-Bet Lab hand review. The pot odds and equity calculators work without one.
