BBO Discussion Forums: a lin editor utility - BBO Discussion Forums

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

a lin editor utility

#1 User is offline   patroclo 

  • PipPipPipPip
  • Group: Full Members
  • Posts: 311
  • Joined: 2003-April-30

Posted 2014-April-11, 13:06

Someone has an utility to download all the hands of a played tournment by other players as a lin file with all the hands without bidding and play.
or an utility to join many single hand lin files in a file with multiple hands.
For using in the Windows version of movie maker to join comment.
0

#2 User is offline   inquiry 

  • PipPipPipPipPipPipPipPipPipPip
  • Group: Admin
  • Posts: 14,566
  • Joined: 2003-February-13
  • Gender:Male
  • Location:Amelia Island, FL
  • Interests:Bridge, what else?

Posted 2014-April-11, 18:52

View Postpatroclo, on 2014-April-11, 13:06, said:

Someone has an utility to download all the hands of a played tournment by other players as a lin file with all the hands without bidding and play.
or an utility to join many single hand lin files in a file with multiple hands.
For using in the Windows version of movie maker to join comment.


(Does) "Someone has an utility to download all the hands of a played tournment by other players as a lin file with all the hands without bidding and play?"

AND

(Does someone have a) a utility to join many single hand lin files in a file with multiple hands.


I am not sure of a utility to do this -- and if there is, I would like a copy of it too-- but you can do it yourself with a little work. I don't know a simple one step utility to do this, but it is very doable with a little effort on your part if you have Microsoft office and the free Double Dummy Solver by Bridge Captain. Here is one way that works, there are probably a lot of easier ways...

Step 1. Download hands your want using Double dummy solver (to get hands from a tournament, you will have to search for the hands of one player who played it it)

Step 2. Prepare the saved PBN created by Double Dummy solver to work with NetbridgeVu (how I would approach it) or use some other PBN -> to -> LIN converter (I use word). If you have a good pbn to lin converter you can skip step 3.

Step 3. Open PBN file with Netbridgevu (if the file has more than 64 hands, all the hands will be converted to LIN format but hands 65 to whatever will all be numbered 64 and only 64 will show up in the Vugraph in NetbridgeVU.

Step 4. Only really needed if you want to remove the bidding and play... make all the content of each hand (bidding. play, etc) a single paragraph (I use word for this as well)

Step 5. Copy and paste the hands from step 4 into an single column (say column A) in column be have this equation =LEFT(A1,SEARCH("|sv|",A2,1)+5) in column B (copied to each cell in column B where A2 become B2, etc). This will leave you a group of hands with no bidding and no play (but the players names will be left). If you want to remove the players names, you can add the following equation to column C to strip the hands of the player names... RIGHT(B1,(LEN(B1)-SEARCH("|st|",B1))).

Using EXCEL you can actually build a database of your own hands similar to what is done in BridgeBrowser. You can search hands you bid by final contract, by opening bid, response, vulnerability, auction several layers deep,overcall, your HCP, your partner's HCP etc,. The reason is once you get the hands in EXCEL, you can retrieve them using autofilters, but that is another story. I have over 4000 of my hands in just such an excel spreadsheet.

Here is some of the details.... For step 2 you have to make a very minor change to the PBN file from Double Dummy Solver.... You replace all ## in the file with nothing. You add [Event "BBO Hands"] every place in the file where there you find [Board (also note that this will give you two "BBO HANDS" in the file because it already exist for the first hand. You need to remove one of these.

Here is a word macro which should do this for you (maybe not the double "BBO HANDS" at the first of the file.


Sub Prepare_PBN()
'
' Prepare_PBN Macro
' adds [Event "BBO Hands"] to each hand in PBN FILE
'
	Selection.Find.ClearFormatting
	Selection.Find.Replacement.ClearFormatting
	With Selection.Find
    	.Text = "##"
    	.Replacement.Text = ""
    	.Forward = True
    	.Wrap = wdFindContinue
    	.Format = False
    	.MatchCase = False
    	.MatchWholeWord = False
    	.MatchWildcards = False
    	.MatchSoundsLike = False
    	.MatchAllWordForms = False
	End With
	Selection.Find.Execute Replace:=wdReplaceAll
	With Selection.Find
    	.Text = "[Board"
    	.Replacement.Text = "[Event ""BBO Hands""]^p[Board"
    	.Forward = True
    	.Wrap = wdFindContinue
    	.Format = False
    	.MatchCase = False
    	.MatchWholeWord = False
    	.MatchWildcards = False
    	.MatchSoundsLike = False
    	.MatchAllWordForms = False
	End With
	Selection.Find.Execute Replace:=wdReplaceAll
End Sub



After you run the above macro, save the file from word as plain text with a PBN file extension. Then open it in netbridgevu. A new file with the same file name but with a lin file extension will be created. This will have the bidding and play. If you want to remove the bidding and play, you can do this very easily in excel.. First, I guess I would open the lin file also in something like word and remove all the unnecessary hard returns so that each hand is just one line. This is not needed, but if you are going to put the hands in excel to remove bidding and play or to create your own "poor man's" bridgebrowser database, it is needed. The macro that works in word is given below.


Sub robot()
'
' robot Macro
' Converts robot lin files to right format for excel
'
	Selection.Find.ClearFormatting
	Selection.Find.Replacement.ClearFormatting
	With Selection.Find
    	.Text = "^p"
    	.Replacement.Text = ""
    	.Forward = True
    	.Wrap = wdFindContinue
    	.Format = False
    	.MatchCase = False
    	.MatchWholeWord = False
    	.MatchWildcards = False
    	.MatchSoundsLike = False
    	.MatchAllWordForms = False
	End With
	Selection.Find.Execute Replace:=wdReplaceAll
	Selection.Find.Execute Replace:=wdReplaceAll
	With Selection.Find
    	.Text = "|pn|"
    	.Replacement.Text = "|^ppn|"
    	.Forward = True
    	.Wrap = wdFindContinue
    	.Format = False
    	.MatchCase = False
    	.MatchWholeWord = False
    	.MatchWildcards = False
    	.MatchSoundsLike = False
    	.MatchAllWordForms = False
	End With
	Selection.Find.Execute Replace:=wdReplaceAll
	With Selection.Find
    	.Text = "|mn|"
    	.Replacement.Text = "|^p^pmn|"
    	.Forward = True
    	.Wrap = wdFindContinue
    	.Format = False
    	.MatchCase = False
    	.MatchWholeWord = False
    	.MatchWildcards = False
    	.MatchSoundsLike = False
    	.MatchAllWordForms = False
	End With
	Selection.Find.Execute Replace:=wdReplaceAll
End Sub

Sub Prepare_PBN()
'
' Prepare_PBN Macro
' adds [Event "BBO Hands"] to each hand in PBN FILE
'
	Selection.Find.ClearFormatting
	Selection.Find.Replacement.ClearFormatting
	With Selection.Find
    	.Text = "##"
    	.Replacement.Text = ""
    	.Forward = True
    	.Wrap = wdFindContinue
    	.Format = False
    	.MatchCase = False
    	.MatchWholeWord = False
    	.MatchWildcards = False
    	.MatchSoundsLike = False
    	.MatchAllWordForms = False
	End With
	Selection.Find.Execute Replace:=wdReplaceAll
	With Selection.Find
    	.Text = "[Board"
    	.Replacement.Text = "[Event ""BBO Hands""]^p[Board"
    	.Forward = True
    	.Wrap = wdFindContinue
    	.Format = False
    	.MatchCase = False
    	.MatchWholeWord = False
    	.MatchWildcards = False
    	.MatchSoundsLike = False
    	.MatchAllWordForms = False
	End With
	Selection.Find.Execute Replace:=wdReplaceAll
End Sub



Perhaps this is too much, but if you would like to talk about it, feel free to email me at bridgebase dot com (my username), or send me private mail here on the forum.



--Ben--

#3 User is offline   patroclo 

  • PipPipPipPip
  • Group: Full Members
  • Posts: 311
  • Joined: 2003-April-30

Posted 2014-April-11, 23:31

Thanks, you have understood what i want, But maybe too difficult for me, I don't use Excel but i attempt to make it
0

#4 User is offline   uday 

  • PipPipPipPipPipPipPipPip
  • Group: Advanced Members
  • Posts: 5,808
  • Joined: 2003-January-15
  • Gender:Male
  • Location:USA

Posted 2014-April-12, 10:06

I don't understand the request.


Consider a tournament with 10 tables, 8 boards.

You want to get 80 LINs in a single file?
0

#5 User is offline   patroclo 

  • PipPipPipPip
  • Group: Full Members
  • Posts: 311
  • Joined: 2003-April-30

Posted 2014-April-12, 12:45

I want to make a lin file with 10 hands of a tournament but without bid and play.
These 10 hands are played by other player than me.
any suggestion ?
0

#6 User is offline   patroclo 

  • PipPipPipPip
  • Group: Full Members
  • Posts: 311
  • Joined: 2003-April-30

Posted 2014-April-13, 00:47

Or also . where to find the help instructions of the movie button in the bbo Windows version.Maybe there one may charge single hand lin file and achieve a ten hands file. The last option is to use movie inserting card to card but it needs a long time
0

#7 User is offline   inquiry 

  • PipPipPipPipPipPipPipPipPipPip
  • Group: Admin
  • Posts: 14,566
  • Joined: 2003-February-13
  • Gender:Male
  • Location:Amelia Island, FL
  • Interests:Bridge, what else?

Posted 2014-April-13, 13:12

View Postpatroclo, on 2014-April-13, 00:47, said:

Or also . where to find the help instructions of the movie button in the bbo Windows version.Maybe there one may charge single hand lin file and achieve a ten hands file. The last option is to use movie inserting card to card but it needs a long time


If you are willing to work with one hand at a time, you can open any hand in html format and do it all with a single equation in Excel or Suns free office spreadsheet. Here is one such hand you played...
http://www.bridgebase.com/tools/handviewer.html?lin=pn|madhusudha,criquet8,patroclo,kouka1|st%7C%7Cmd%7C4S78JH6KD67KC3689J%2CS3AH57TD289QC2TKA%2CS25TKH248JD4TJAC4%2C%7Crh%7C%7Cah%7CBoard%2014%7Csv%7Co%7Cmb%7Cp%7Cmb%7Cp%7Cmb%7C1D%7Cmb%7Cp%7Cmb%7C1H%7Cmb%7Cp%7Cmb%7C1N%7Cmb%7Cp%7Cmb%7Cp%7Cmb%7Cp%7Cpc%7CS2%7Cpc%7CS4%7Cpc%7CS8%7Cpc%7CSA%7Cpc%7CH5%7Cpc%7CH2%7Cpc%7CH9%7Cpc%7CHK%7Cpc%7CC6%7Cpc%7CC2%7Cpc%7CC4%7Cpc%7CCQ%7Cpc%7CHA%7Cpc%7CH6%7Cpc%7CH7%7Cpc%7CH4%7Cpc%7CHQ%7Cpc%7CC3%7Cpc%7CHT%7Cpc%7CH8%7Cpc%7CC5%7Cpc%7CC8%7Cpc%7CCT%7Cpc%7CS5%7Cpc%7CCA%7Cpc%7CST%7Cpc%7CC7%7Cpc%7CCJ%7Cpc%7CCK%7Cpc%7CD4%7Cpc%7CD3%7Cpc%7CC9%7Cpc%7CS3%7Cpc%7CSK%7Cpc%7CS6%7Cpc%7CS7%7Cpc%7CHJ%7Cpc%7CH3%7Cpc%7CD6%7Cpc%7CD2%7Cpc%7CDT%7Cpc%7CD5%7Cpc%7CDK%7Cpc%7CD8%7Cpc%7CD7%7Cpc%7CD9%7Cpc%7CDJ%7Cpc%7CS9%7Cpc%7CDA%7Cpc%7CSQ%7Cpc%7CSJ%7Cpc%7CDQ%7C


I will show you two ways to get where you want with a single equation in excel, but first I will go through a few steps to show you how it is working. First thing to do is to paste the html hand inro cell A1 in either excel or the free sun office. I don't like all the %20;s and %7C, and %2C, so I run a macro to change them to:
%20 = a space
%7C = |
%2c = ,


In cell b1 and c1 and d1 have the three "equations"
For cell B1 - this strips off the http address stuff through the equal sign
=RIGHT(A1,(LEN(A1)-52)) 


in b1 you will have the lin file content with players name, bidding, and play
pn|madhusudha,criquet8,patroclo,kouka1|st||md|4S78JH6KD67KC3689JS3AH57TD289QC2TKAS25TKH248JD4TJAC4|rh||ah|Board 14|sv|o|mb|p|mb|p|mb|1D|mb|p|mb|1H|mb|p|mb|1N|mb|p|mb|p|mb|p|pc|S2|pc|S4|pc|S8|pc|SA|pc|H5|pc|H2|pc|H9|pc|HK|pc|C6|pc|C2|pc|C4|pc|CQ|pc|HA|pc|H6|pc|H7|pc|H4|pc|HQ|pc|C3|pc|HT|pc|H8|pc|C5|pc|C8|pc|CT|pc|S5|pc|CA|pc|ST|pc|C7|pc|CJ|pc|CK|pc|D4|pc|D3|pc|C9|pc|S3|pc|SK|pc|S6|pc|S7|pc|HJ|pc|H3|pc|D6|pc|D2|pc|DT|pc|D5|pc|DK|pc|D8|pc|D7|pc|D9|pc|DJ|pc|S9|pc|DA|pc|SQ|pc|SJ|pc|DQ|

In cell C1 put this equation with strips the way bidding and play
=LEFT(B1,SEARCH("|Sv|",B1)+5)


This leaves you with
pn|madhusudha,criquet8,patroclo,kouka1|st||md|4S78JH6KD67KC3689JS3AH57TD289QC2TKAS25TKH248JD4TJAC4|rh||ah|Board 14|sv|o|

Code In d1 should be... this removes the player names
RIGHT(C1,LEN(C1)-SEARCH("|st|",C1))


This leaves you with just the deal
st||md|4S78JH6KD67KC3689JS3AH57TD289QC2TKAS25TKH248JD4TJAC4|rh||ah|Board 14|sv|o|

If all you want is the final product (no player names, no bidding and play), you can combine the equations in cell b1, c1, and d1 into oine equation and put that in cell b1 to get just the hand...

=RIGHT(LEFT(RIGHT(A1,(LEN(A1)-52)),SEARCH("|Sv|", RIGHT(A1,(LEN(A1)-52)))+5),LEN(LEFT(RIGHT(A1,(LEN(A1)-52)),SEARCH("|Sv|", RIGHT(A1,(LEN(A1)-52)))+5))-SEARCH("|st|", LEFT(RIGHT(A1,(LEN(A1)-52)),SEARCH("|Sv|", RIGHT(A1,(LEN(A1)-52)))+5)))


That one equation gives you the same result as using cell b1, c1, and d1 to get to just the hand. It could be simplified by instead of just stripping out the http address line strip out all the way to the start of the hand. The simplified equation if that is all you want is:

=LEFT(RIGHT(A1,(LEN(A1))-SEARCH("|st|",A1)),SEARCH("|Sv|",RIGHT(A1,(LEN(A1))-SEARCH("|st|",A1)))+5)


When you have the bidding and play, you can pull out the opening bid, the response, opener's rebid, did the opponents double or overcall, the opening lead, etc. I can provide equations for things like that if you need or give you an excel spreadsheet that will do that for you. But for what you want, all you need do is copy the code from just above this paragraph and paste it into cell B1 in an excel or sun office spreadsheet and paste the hand in question in cell A1. If you don't remove the %7C's then you have to change the equations so that everywhere there is an | you change it with %7C
--Ben--

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users