扑克手 - 用Java解析日志文件

时间:2012-11-06 22:52:25

标签: java parsing logic poker

您好我正在为大学进行Java项目,在那里我应该分析扑克手。我在txt日志文件中找到了一些扑克牌。

他们通常看起来像这样:

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)

我的问题是我不知道如何继续解析日志文件: 我所掌握的唯一知识就是“手动”逐行扫描特定的字符或符号,但我担心它需要详尽的错误处理。

所以,如果有其他技巧或更好的方法来解析这些扑克牌,我会徘徊吗?

非常感谢你的帮助

编辑:对不起“数据挖掘”,因为它不是问题的一部分。

EDIT2:我也在寻找一些与C ++相同的Java方法

例如: 在C ++中读取5个字符/直到de#symbol将是:myfile.getline(store_in_this_var,5,'#'),您能否建议我使用一些Java方法来做同样的事情?

1 个答案:

答案 0 :(得分:1)

您可能需要按照自己的意思行事:

逐行前进并在该行的开头查找字符。

我写了一个类似的应用程序,几年前分析了来自 FullTilt Poker 的历史文件......

我做了完全相同的事情并且效果很好。


编辑