The pieces are divided, into white and black sets, but their colors should not taken literally. The players are referred to as "White" and "Black", they control their associated pieces. The colors of the sixty-four squares alternate and are referred to "light squares" and "dark squares", sometimes also referred to "White" and "Black" squares.
Since there are only two colors, one bit is sufficient to encode them. This is how one may define colors in C++:
enum enumColor {
ecWhite =0,
ecBlack =1};
Toggle Color
Since the players alternately move, one need to toggle the side to move color after each move made inside the Chess Position object. This can be done by subtracting color from one (ecBlack), ...
The pieces are divided, into white and black sets, but their colors should not taken literally. The players are referred to as "White" and "Black", they control their associated pieces. The colors of the sixty-four squares alternate and are referred to "light squares" and "dark squares", sometimes also referred to "White" and "Black" squares.
Table of Contents
Color Definition
Since there are only two colors, one bit is sufficient to encode them. This is how one may define colors in C++:Toggle Color
Since the players alternately move, one need to toggle the side to move color after each move made inside the Chess Position object. This can be done by subtracting color from one (ecBlack), ...... or a little bit cheaper by xoring with the color with one (ecBlack).
See also
External Links
References
What links here?
Up one Level