rudzen / ChessLib

C# chess library containing a complete data structure and move generation.
MIT License
81 stars 22 forks source link

Square.None #57

Closed JMSSVLC closed 1 year ago

JMSSVLC commented 1 year ago

I have just seen that some of the properties of Square.None are wrong and other ones fire an exception. In particular, File property is "b" and Rank is "9". Maybe File.None and Rank.None should be defined. I am not sure about the penalties in code speed, and if this issue is "on purpose"

rudzen commented 1 year ago

It is intended the way it currently is. Square.None is a special case since it reflects that the square is not a set square, since the value 0 is Square.A1. The recommended use it to check if a square is None before using it. Fx it is used in regard to EnPassant square in State.

Rank.None and File.None is not really needed since a square with the value Square.None is already an indication that the square is not set.