-/// Position::move_is_capture() tests whether a move from the current
-/// position is a capture. Move must not be MOVE_NONE.
-
-bool Position::move_is_capture(Move m) const {
-
- assert(m != MOVE_NONE);
-
- return ( !square_is_empty(move_to(m))
- && (color_of_piece_on(move_to(m)) != color_of_piece_on(move_from(m)))
- )
- || move_is_ep(m);
-}
-
-
-/// Position::backup() is called when making a move. All information
-/// necessary to restore the position when the move is later unmade
-/// is saved to an UndoInfo object. The function Position::restore
-/// does the reverse operation: When one does a backup followed by
-/// a restore with the same UndoInfo object, the position is restored
-/// to the state before backup was called.
-
-void Position::backup(UndoInfo& u) const {
-
- u.castleRights = castleRights;
- u.epSquare = epSquare;
- u.checkersBB = checkersBB;
- u.key = key;
- u.pawnKey = pawnKey;
- u.materialKey = materialKey;
- u.rule50 = rule50;
- u.lastMove = lastMove;
- u.mgValue = mgValue;
- u.egValue = egValue;
- u.capture = NO_PIECE_TYPE;
-
- for (Color c = WHITE; c <= BLACK; c++)
- {
- u.pinners[c] = pinners[c];
- u.pinned[c] = pinned[c];
- u.dcCandidates[c] = dcCandidates[c];
- }
-}
-
-
-/// Position::restore() is called when unmaking a move. It copies back
-/// the information backed up during a previous call to Position::backup.
-
-void Position::restore(const UndoInfo& u) {
-
- castleRights = u.castleRights;
- epSquare = u.epSquare;
- checkersBB = u.checkersBB;
- key = u.key;
- pawnKey = u.pawnKey;
- materialKey = u.materialKey;
- rule50 = u.rule50;
- lastMove = u.lastMove;
- mgValue = u.mgValue;
- egValue = u.egValue;
- // u.capture is restored in undo_move()
-
- for (Color c = WHITE; c <= BLACK; c++)
- {
- pinners[c] = u.pinners[c];
- pinned[c] = u.pinned[c];
- dcCandidates[c] = u.dcCandidates[c];
- }
-}
-
-
-/// Position::update_checkers() is a private method to udpate chekers info