Side to move

Home * Chess * Position * Side to move

Side to move is either the white or black player, who alternatively have the right and the obligation to move. Thus, side to move is a mandatory member or variable inside a Position structure or object, usually a variable or member of a defined Color value range {0,1} or {white, black}, which is toggled after each make - or unmake move. Alternatively, one may use a boolean with the semantic White to move (wtm) or the complement (Black to move - btm) btm = !wtm btm = 1 - wtm; // assuming color ::= {0,1} enum btm = wtm ^ 1; // assuming color ::= {0,1} enum In the Forsyth-Edwards Notation the side to move is specified after the piece placement with the lowercase letters 'w' or 'b'.

However, inside a search tree object, it is sufficient to keep the side to move inside the root node only, and to further rely on the least significant bit (lsb) of the ply-index, which is likely maintained during the search anyway. The ply-index is initialized with zero at the root and incremented after each half move played down the tree. If the ply-index is even (lsb clear) at any node, it has the side to move of the root, odd plies (lsb set) imply the other side to move: side_2_move = (side_2_move@root + ply) & 1; // assuming color ::= {0,1} enum

=See also=
 * Color Flipping
 * Forsyth-Edwards Notation
 * Null Move
 * Tempo
 * Zugzwang

=Forum Posts=
 * Side to Move Bonus - does it help? by Mark Lefler, CCC, May 29, 2009 » Tempo
 * Using side to move as a separate bit in hash key by J. Wesley Cleveland, CCC, August 06, 2016 » Transposition Table
 * side-to-move bonus for several eval terms by Sander Maassen vd Brink, CCC, October 27, 2017 » Tempo

Up one Level