1

Hello I am carrying on a Java project for the university, where I should analyse poker hands. I found some poker hands in a txt log file.

They would typically look like this:

PokerStars Zoom Hand #86981279921:  Hold'em No Limit ($0.10/$0.25 USD) - 2012/09/30 23:49:51 ET
Table 'Whirlpool Zoom 40-100 bb' 9-max Seat #1 is the button
Seat 1: lgwong ($30.99 in chips) 
Seat 2: hastyboots ($28.61 in chips) 
Seat 3: seula i ($25.31 in chips) 
Seat 4: fr_kevin01 ($31.81 in chips) 
Seat 5: limey05 ($27.45 in chips) 
Seat 6: sanlu ($24.65 in chips) 
Seat 7: Masterfrank ($25.35 in chips) 
Seat 8: Refu$e2Lose ($33.23 in chips) 
Seat 9: 1pepepe0114 ($37.62 in chips) 
hastyboots: posts small blind $0.10
seula i: posts big blind $0.25
*** HOLE CARDS ***
fr_kevin01: folds 
limey05: folds 
sanlu: folds 
Masterfrank: folds 
Refu$e2Lose: folds 
1pepepe0114: folds 
lgwong: folds 
hastyboots: folds 
Uncalled bet ($0.15) returned to seula i
seula i collected $0.20 from pot
seula i: doesn't show hand 
*** SUMMARY ***
Total pot $0.20 | Rake $0 
Seat 1: lgwong (button) folded before Flop (didn't bet)
Seat 2: hastyboots (small blind) folded before Flop
Seat 3: seula i (big blind) collected ($0.20)
Seat 4: fr_kevin01 folded before Flop (didn't bet)
Seat 5: limey05 folded before Flop (didn't bet)
Seat 6: sanlu folded before Flop (didn't bet)
Seat 7: Masterfrank folded before Flop (didn't bet)
Seat 8: Refu$e2Lose folded before Flop (didn't bet)
Seat 9: 1pepepe0114 folded before Flop (didn't bet)

My problem is that I am not sure about how to proceed to parse the log file: the only knowledge I have is "manually" scanning line by line for a particular character or symbol, but I am afraid it would need exhaustive error handling.

So I was wandering if there is any other techniques or better way to parse these poker hands?

Many thanks for your help

EDIT: Sorry for the "Data Mining", as it is not part of the question.

EDIT2: I was also looking for some Java methods to do the same as C++

For example: In C++ read 5 characters/until de # symbol would be: myfile.getline(store_in_this_var,5,'#'), could you suggest me some Java method to do the same?

nuvio
  • 2,555
  • 4
  • 32
  • 58
  • This is not data mining at all =\ – Luiggi Mendoza Nov 06 '12 at 22:57
  • *the only knowledge I have is "manually" scanning line by line for a particular character or symbol* yes, that's the purpose of this assignment (at least that how it looks). What have you tried? – Luiggi Mendoza Nov 06 '12 at 22:58
  • 1
    @Adam - I don't even think they're necessary... – jahroy Nov 06 '12 at 23:05
  • @Luiggi I haven't tried anything yet, this is why I am asking if there is a better way to do it. This is not a defined assignment but an open project, I was wondering if someone know any library to parse PokerStars hands...Otherwise I will do the -hard- way – nuvio Nov 06 '12 at 23:06

1 Answers1

1

You probably need to do just what you say:

Go line by line and look for characters at the start of the line.

I wrote a similar app that analyzed history files from FullTilt Poker a few years ago...

I did the exact same thing and it worked pretty well.


EDIT:

jahroy
  • 22,322
  • 9
  • 59
  • 108
  • I come from a c++ background, which methods would you use in java to read the log? In c++ I was doing like: myfile.getline(store_in_this_var,5,'#') – nuvio Nov 09 '12 at 18:35
  • 1
    I would probably use a _BufferedReader_, which makes it easy to read a file line by line. You can create one from a FileReader. Your best bet is to get used to reading the API docs... That's an important part of java programming. Here's a link to the documentation for _BufferedReader_: http://docs.oracle.com/javase/6/docs/api/java/io/BufferedReader.html – jahroy Nov 09 '12 at 19:04