]> git.sesse.net Git - stockfish/commit
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)
commit822695d4d3a9336dc54bfabd0996e75865358ae2
tree1b2089c70a740e62fecd0824819902b56893778f
parent2acda1fde3e1542a0b1bfc5a0885559e6daf142a
Use a Direction enum for Square deltas

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.
src/bitbase.cpp
src/bitboard.cpp
src/bitboard.h
src/endgame.cpp
src/evaluate.cpp
src/movegen.cpp
src/pawns.cpp
src/position.cpp
src/psqt.cpp
src/types.h