Open qhapaq-49 opened 2 years ago
@qhapaq-49 Thank you for making the pull request. Sorry for my late review.
This pull request is very helpful to parse floodgate CSAs. Also, I've read your tweet. https://twitter.com/Qhapaq_49/status/1543977762826113025
The discussion section is very helpful. My suggestion is, we can introduce a parser option and set floodgate
mode explicitly, introduce a new dict key floodgate
and set all the values from the comment under the key.
Other comments,
value
is too common name. But evaluation_value
is too long. I don't have a good idea.comments
could be sparse. It could be dict
. If the comment parser is only for reading floodgate logs like the above suggestion and the log has many comments, keeping the current list
is okay.Thank you for your comment and I am sorry for my late response. I agree your suggestion. I will push PR again after I have made an update based on your advice.
I attached a comment, pv and value parser in CSA. It would be useful for the analysis of the playout in floodgate. Example of io is shown below
input
output
{'moves': ['2g2f', '3c3d', '7g7f'], 'sfen': 'lnsgkgsnl/1r5b1/ppppppppp/9/9/9/PPPPPPPPP/1B5R1/LNSGKGSNL b - 1', 'names': ['NAKAHARA', 'YONENAGA'], 'win': 'b', 'values': [[22], [0], []], 'comments' : ['', '', ["'using csa format is a kind of torment!"]], 'pvs': [[['8c8d']], [['2f2e', '8c8d', '6i7h', '8d8e', '3i3h', '7a7b', '9g9f']], []], 'comments': [[], [], ["'using csa format is a kind of torment!"]]}
Discussion
As far as I know, CSA format does not provide strict rules to determine which comments contain PV and values. This PR supports CSA files generated by floodgate. Comment parser in this PR would raise error when comment format is different from floodgate's format. Therefore, it is preferable to skip the comment parser when it raises errors.
This parser tries to support MultiPV and multiline comments to gather the information by list. However, floodgate does not support MultiPV and multiline comments.