niklasf / python-chess

A chess library for Python, with move generation and validation, PGN parsing and writing, Polyglot opening book reading, Gaviota tablebase probing, Syzygy tablebase probing, and UCI/XBoard engine communication
https://python-chess.readthedocs.io/en/latest/
GNU General Public License v3.0
2.45k stars 531 forks source link

Validate new nodes on GameNode #982

Closed parszab closed 1 year ago

parszab commented 1 year ago

It's more a question, than a suggestion, I'm sure there are reasons: but why exactly is there no move validation against the GameNode's board when there is a new variation added?

niklasf commented 1 year ago

It's about performance.

Chess operations in Python are already quite slow, so I decided to avoid input validation on (basically) all functions that accept objects, as a general pattern in this library.

However any strings or files that are parsed are always fully validated.

parszab commented 1 year ago

Got it, thx.