比較變量我有一個棘手的問題,似乎就像我卡住了。我有一個想法如何繼續,但不知道如何在實踐中做到這一點。PHP正則表達式和字符串
我想要做什麼是轉換.txt文件爲另一種格式中的字符串(使用正則表達式和變量?)。主要問題是當我需要轉換那些標有//註釋的行時。
注意:「... villainx調用$ x」的計算方式在原始方式和格式上應該轉換爲不同的格式。這就是我需要一些嚴重幫助的問題。
舉例: 這需要轉換...
HERO posts small blind $0.50.
villain4 posts big blind $1.00.
** Dealing down cards **
Dealt to HERO [ 7s 8c 5d 8d ]
villain1 calls $1.00
villain2 raises to $3.00 // total sum a player raises to
villain3 calls $3.00
HERO calls $3.00
villain4 calls $3.00
villain1 calls $3.00 // total sum a player calls whether he has put money in to the pot before (as he has -- $1 call, first to act)
** Dealing Flop ** [ 9c, Ah, Jh ]
...這樣的:
HERO posts small blind [$0.50 USD].
villain4 posts big blind [$1.00 USD].
** Dealing down cards **
Dealt to HERO [ 7s 8c 5d 8d ]
villain1 calls [$1.00 USD]
villain2 raises [$3.00 USD] // total sum a player raises to
villain3 calls [$3.00 USD]
HERO calls [$2.50 USD] // a sum player calls = last raise ($3) - money put in (=$0.50 small blind)
villain4 calls [$2.00 USD] // $3 - $1 (big blind)
villain1 calls [$2.00 USD] // $3 - $1 (the call first to act)
** Dealing Flop ** [ 9c, Ah, Jh ]
又如:
HERO posts small blind $0.50.
villain4 posts big blind $1.00.
** Dealing down cards **
Dealt to HERO [ 7s 8c 5d 8d ]
villain1 bets $5.50
villain2 raises to $20.00
villain3 raises to $40.00
villain1 calls $40.00 //THIS NEEDS TO BE "calls $34.50"
villain2 calls $40.00 //THIS NEEDS TO BE "calls $20.00"
** Dealing Flop ** [ 9c, Ah, Jh ]
和這裏的完整的例子整隻手應該看起來如何。 txt文件可能包含數百手。我設法基本上除了上面提到的所有其他問題之外,我迷路了。請幫幫我! :d
***** Hand History for Game 335502358 ***** (Full Tilt)
$100.00 USD PL Omaha - Thursday, October 15, 01:32:21 ET 2009
Table Foxtrot (Real Money)
Seat 3 is the button
Seat 1: villain1 ($38.50 USD)
Seat 2: villain2 ($99.65 USD)
Seat 3: villain3 ($415.55 USD)
Seat 4: HERO ($99.00 USD)
Seat 6: villain4 ($171.20 USD)
HERO posts small blind [$0.50 USD].
villain4 posts big blind [$1.00 USD].
** Dealing down cards **
Dealt to HERO [ 7s 8c 5d 8d ]
villain1 calls [$1.00 USD]
villain2 raises [$3.00 USD]
villain3 calls [$3.00 USD]
HERO calls [$2.50 USD]
villain4 calls [$2.00 USD]
villain1 calls [$2.00 USD]
** Dealing Flop ** [ 9c, Ah, Jh ]
HERO checks
villain4 checks
villain1 checks
villain2 bets [$8.00 USD]
villain3 folds
HERO folds
villain4 calls [$8.00 USD]
villain1 folds
** Dealing Turn ** [ Th ]
villain4 checks
villain2 bets [$13.00 USD]
villain4 calls [$13.00 USD]
** Dealing River ** [ 3c ]
villain4 checks
villain2 checks
villain2 shows [Qc, Js 8s Qd ]
villain4 shows [Kh, Tc 7h Kd ]
villain4 wins $54.15 USD from main pot
編輯1:補充說明,以澄清
編輯2我真正的問題:加入另一個例子
我認爲你需要更具體一點,你希望達到的目標。新值如何計算?舉例來說,你怎麼知道villain3的通話保持爲3.00美元,但隨後的通話是否改變? – Ben 2009-11-03 13:21:04