Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Don't check to see if p4_make_move is really making a move

Also reorder removal from the piece cache to match the order of addition
even though it makes no difference.
  • Loading branch information...
commit c0bcd891b2e58c0700e5400f6ebf0dc94017baeb 1 parent 93c93d4
@douglasbagnall authored
Showing with 6 additions and 8 deletions.
  1. +6 −8 src/engine.js
View
14 src/engine.js
@@ -709,8 +709,7 @@ function p4_make_move(state, s, e, promotion){
state.castles &= ~mask;
}
- if (piece)
- piece_locations.push([end_piece, e]);
+ piece_locations.push([end_piece, e]);
return {
/*some of these (e.g. rook) could be recalculated during
@@ -732,18 +731,17 @@ function p4_make_move(state, s, e, promotion){
function p4_unmake_move(state, move){
var board = state.board;
- if(move.rs){
- board[move.rs] = move.rook;
- board[move.re] = 0;
- move.piece_locations.length--;
- }
if (move.ep_position){
board[move.ep_position] = move.ep_taken;
}
board[move.s] = move.S;
board[move.e] = move.E;
- if (move.S & 15)
+ move.piece_locations.length--;
+ if(move.rs){
+ board[move.rs] = move.rook;
+ board[move.re] = 0;
move.piece_locations.length--;
+ }
state.castles = move.castles;
}
Please sign in to comment.
Something went wrong with that request. Please try again.