position: Remove void Position::undo_move(Move m)
This commit is contained in:
parent
e709af4e14
commit
e394bf8dd2
|
@ -471,70 +471,6 @@ void Position::do_move(Move m)
|
|||
/// Position::undo_move() unmakes a move. When it returns, the position should
|
||||
/// be restored to exactly the same state as before the move was made.
|
||||
|
||||
void Position::undo_move(Move m)
|
||||
{
|
||||
assert(is_ok(m));
|
||||
|
||||
#if 0
|
||||
sideToMove = ~sideToMove;
|
||||
|
||||
Color us = sideToMove;
|
||||
Square from = from_sq(m);
|
||||
Square to = to_sq(m);
|
||||
Piece pc = piece_on(to);
|
||||
|
||||
assert(empty(from));
|
||||
|
||||
{
|
||||
move_piece(to, from); // Put the piece back at the source square
|
||||
|
||||
if (st.capturedPiece) {
|
||||
Square capsq = to;
|
||||
|
||||
put_piece(st.capturedPiece, capsq); // Restore the captured piece
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
bool ret = false;
|
||||
|
||||
// TODO Start
|
||||
MoveType mt = type_of(m);
|
||||
|
||||
switch (mt) {
|
||||
case MOVETYPE_REMOVE:
|
||||
ret = put_piece(to_sq((Move)-m));
|
||||
break;
|
||||
case MOVETYPE_MOVE:
|
||||
if (select_piece(to_sq(m))) {
|
||||
ret = put_piece(from_sq(m));
|
||||
}
|
||||
break;
|
||||
case MOVETYPE_PLACE:
|
||||
ret = remove_piece(static_cast<Square>(m));
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (!ret) {
|
||||
return;
|
||||
}
|
||||
|
||||
// TODO: Adjust
|
||||
//int pieceInHandCount[COLOR_NB]{ 0 };
|
||||
//int pieceOnBoardCount[COLOR_NB]{ 0 };
|
||||
//int pieceToRemoveCount{ 0 };
|
||||
|
||||
// TODO End
|
||||
|
||||
// Finally point our state pointer back to the previous state
|
||||
//st = st.previous;
|
||||
--gamePly;
|
||||
|
||||
assert(pos_is_ok());
|
||||
}
|
||||
|
||||
void Position::undo_move(Sanmill::Stack<Position> &ss)
|
||||
{
|
||||
memcpy(this, ss.top(), sizeof(Position));
|
||||
|
|
|
@ -76,7 +76,6 @@ public:
|
|||
|
||||
// Doing and undoing moves
|
||||
void do_move(Move m);
|
||||
void undo_move(Move m);
|
||||
void undo_move(Sanmill::Stack<Position> &ss);
|
||||
|
||||
// Accessing hash keys
|
||||
|
|
Loading…
Reference in New Issue