【发布时间】:2018-01-10 19:14:45
【问题描述】:
我需要一些帮助来启动一个程序。我每周都会参加几场在线扑克锦标赛。事实证明,我使用的网站记录了手的历史并将它们作为 .txt 文件保存到我的硬盘驱动器中。不幸的是,数据的格式有点粗略。我想创建一个程序,让每只手告诉我我赢了多少或输了多少。我从下面的一只手中粘贴了一个样本,我想从每只手中提取以下信息。
盲注和底注。向下滚动示例,您可以看到“玩家 8 有小盲注 (250)”,然后是“玩家 1 有大盲注 (500) ”。上面为每个玩家“Player Hero ante (50)”注明了底注。所以在这种情况下,小盲注 = 250,大盲注 = 500,底注 = 50。
我的筹码量。我已将我的玩家称为“英雄”。我的筹码量在第 6 行,上面写着“Seat 3: Hero (17595)”。在这种情况下,我的堆栈大小是 17595。
我的手。在本例中,它表示为“玩家英雄收到牌:[10c];玩家英雄收到牌:[7h]。”所以我的手是“10c7h”
玩家人数。 在示例中,有 8 名玩家。
我的立场。这可能有点棘手。我决定从大盲注开始并将其赋值为 0。小盲注 = 1,按钮 = 2,等等。这在某种程度上违背了“扑克逻辑”,但从编程的角度来看,更有意义我是因为总会有大盲注,而其他一些位置将取决于牌桌上有多少玩家。
盈利/亏损。它位于“摘要”标签下的文本底部附近。 “玩家英雄不显示牌。投注:50。收集:0。输:50。”在这种情况下,我的利润是 -50(即损失 50),这意味着我支付了 50 ante 并弃牌。
这是 .txt 文件的外观。请注意,这是 1 手。在实际的 .txt 文件中,这手牌后面会跟着几十或几百手牌。开头总是用“游戏开始”表示,最后一行总是说“游戏结束”。
Game started at: 2018/1/9 10:14:10
Game ID: 1094127759 250/500 $5,000 GTD, Table 4 (Hold'em)
Seat 7 is the button
Seat 1: Player1 (9650).
Seat 2: Player2 (19433).
Seat 3: Hero (17595).
Seat 4: Player4 (8900).
Seat 5: Player5 (12670).
Seat 6: Player6 (11187).
Seat 7: Player7 (11300).
Seat 8: Player8 (17603).
Player Player8 ante (50)
Player Player1 ante (50)
Player Player2 ante (50)
Player Hero ante (50)
Player Player4 ante (50)
Player Player5 ante (50)
Player Player6 ante (50)
Player Player7 ante (50)
Player Player8 has small blind (250)
Player Player1 has big blind (500)
Player Player8 received a card.
Player Player8 received a card.
Player Player1 received a card.
Player Player1 received a card.
Player Player2 received a card.
Player Player2 received a card.
Player Hero received card: [10c]
Player Hero received card: [7h]
Player Player4 received a card.
Player Player4 received a card.
Player Player5 received a card.
Player Player5 received a card.
Player Player6 received a card.
Player Player6 received a card.
Player Player7 received a card.
Player Player7 received a card.
Player Player2 folds
Player Hero folds
Player Player4 raises (1000)
Player Player5 folds
Player Player6 folds
Player Player7 folds
Player Player8 folds
Player Player1 folds
Uncalled bet (500) returned to Player4
Player Player4 mucks cards
------ Summary ------
Pot: 1650
Player Player1 does not show cards.Bets: 550. Collects: 0. Loses: 550.
Player Player2 does not show cards.Bets: 50. Collects: 0. Loses: 50.
Player Hero does not show cards.Bets: 50. Collects: 0. Loses: 50.
*Player Player4 mucks (does not show cards). Bets: 550. Collects: 1650. Wins: 1100.
Player Player5 does not show cards.Bets: 50. Collects: 0. Loses: 50.
Player Player6 does not show cards.Bets: 50. Collects: 0. Loses: 50.
Player Player7 does not show cards.Bets: 50. Collects: 0. Loses: 50.
Player Player8 does not show cards.Bets: 300. Collects: 0. Loses: 300.
Game ended at: 2018/1/9 10:14:52
感谢任何帮助。甚至只是关于我如何去做这件事或者我应该学习什么样的东西的一些想法。在我看来,输出应该是这样的:
HandNumber = 000001
BigBlind = 500
Ante = 50
Players = 8
StackSize = 17595
Hand = 10c7h
Position = 6 # small blind = 1; add 5 since I'm 5 positions removed
Profit = -50
我的经验水平:我已经学习 Python 开发、数据科学和 SQL 的在线课程大约 6 个月了。我对课程有些熟悉,但没有大量创建自己的课程的经验。我设计了一些程序来帮助使用正则表达式从财务报表中提取数据。
【问题讨论】: