dominicprice / endplay

A suite of tools for generation and analysis of bridge deals. Read the documentation at https://endplay.readthedocs.io
MIT License
21 stars 5 forks source link

Many of my .pbn files have statistics. #51

Open ADavidBailey opened 4 weeks ago

ADavidBailey commented 4 weeks ago

I want to use your code to read .pbn files and create .lin files. Dealer V1 and V2 accepts the files and ignores the statistics. Your pbn.load(i_file) fails.

Here's an example:

Minimum : 33.6 Avg : 33.4 Max : 33 5S and 6+D : 22.6 5S and 6+C : 26.2 5H and 6+D : 24.6 5H and 6+C : 26.6 Frequency HCP South : 14 39 15 166 16 173 17 122 18 0 Frequency ntPoints : 14 0 15 168 16 167 17 165 18 0 Generated 2922012 hands Produced 500 hands Initial random seed 1717799357 Time needed 8.000 sec

ADavidBailey commented 4 weeks ago

I added lines 340 and 341 following the else. That solves my problem. else:

Skip lines without a tag -- Added by David Bailey

        return False
        raise PBNDecodeError("Expected a tag", curline, self.lineno)
ADavidBailey commented 3 weeks ago

BBO will not open/read these .lin files. I know the .lin files that I create are much, much larger that BBO would expect. So I created one with only 24 deals. BBO will not open/read it either. Here are the first four lines...

pn|-,-,-,-|st||md|3S35AH45AD238TQACJ,S9TQH689D456KC34K,S47JKHTQKD7JC278Q,|rh||ah|Board 1|sv|o|pg|| pn|-,-,-,-|st||md|4S689H47D2356C5JQK,S7TJKAH35689ADKCT,S245QHJKD489C4689,|rh||ah|Board 2|sv|n|pg|| pn|-,-,-,-|st||md|1S9H3789D38KAC79JA,S45JH4JAD567TC56T,S267TAH6TQKDQC38K,|rh||ah|Board 3|sv|e|pg|| pn|-,-,-,-|st||md|2S3TJH45JQD26C249A,S45KAHAD378TC68TK,S6789H79TD45JC7JQ,|rh||ah|Board 4|sv|b|pg||

UPDATE: If I delete the pn|-,-,-,-|st|| at the beginning of each line, BBO will import the file.

ADavidBailey commented 3 weeks ago

I wrote a simple program to comment any 'statistics' in pbn files. These lines are still in the pbn files with an '# ' as the first two characters of the lines.

I printed them to stats.txt. Have a look.

https://github.com/ADavidBailey/Practice-Bidding-Scenarios/blob/main/stats.txt

ADavidBailey commented 3 weeks ago

pn|-,-,-,-|st||md|1S9H3789D38KAC79JA,S45JH4JAD567TC56T,S267TAH6TQKDQC38K,|rh||ah|Board 3|sv|e|pg|| pn|-,-,-,-|st||md|2S3TJH45JQD26C249A,S45KAHAD378TC68TK,S6789H79TD45JC7JQ,|rh||ah|Board 4|sv|b|pg||

UPDATE: If I delete the pn|-,-,-,-|st|| at the beginning of each line, BBO will import the file.

BBO relies on the qx|o1| to display the imported board number correctly. I wrote a program to insert the board number after the '0'. Now, they're like this for boards 9 and 10:

qx|o9|md|3S2TKH37TQD4KAC45J,S589AH45JKD25TQCQ,S67JQH9AD379C678T,|rh||ah|Board 9|sv|e|pg|| qx|o10|md|4S369QH239TD5JAC2Q,S47TJKH456JD9C9KA,SAH78QKD236QC578J,|rh||ah|Board 10|sv|b|pg||

They seem to work everywhere.

dominicprice commented 3 weeks ago

thanks for persevering with this, i will try and collect all the lin fixes and update the parser!

ADavidBailey commented 2 weeks ago

Per advise of Thorvald, I changed the comment line 1st character from # to %