]> git.sesse.net Git - stockfish/commitdiff
Use a Direction enum for Square deltas
authorsyzygy1 <ronalddeman@yahoo.com>
Mon, 4 Dec 2017 16:52:31 +0000 (17:52 +0100)
committerMarco Costalba <mcostalba@users.noreply.github.com>
Mon, 4 Dec 2017 16:52:31 +0000 (17:52 +0100)
Currently the NORTH/WEST/SOUTH/EAST values are of type Square, but conceptually they are not squares but directions. This patch separates these values into a Direction enum and overloads addition and subtraction to allow adding a Square to a Direction (to get a new Square).

I have also slightly trimmed the possible overloadings to improve type safety. For example, it would normally not make sense to add a Color to a Color or a Piece to a Piece, or to multiply or divide them by an integer. It would also normally not make sense to add a Square to a Square.

This is a non-functional change.


No differences found