Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

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
Douglas Bagnall authored

Showing 1 changed file with 6 additions and 8 deletions. Show diff stats Hide diff stats

  1. +6 8 src/engine.js
14 src/engine.js
@@ -709,8 +709,7 @@ function p4_make_move(state, s, e, promotion){
709 709 state.castles &= ~mask;
710 710 }
711 711
712   - if (piece)
713   - piece_locations.push([end_piece, e]);
  712 + piece_locations.push([end_piece, e]);
714 713
715 714 return {
716 715 /*some of these (e.g. rook) could be recalculated during
@@ -732,18 +731,17 @@ function p4_make_move(state, s, e, promotion){
732 731
733 732 function p4_unmake_move(state, move){
734 733 var board = state.board;
735   - if(move.rs){
736   - board[move.rs] = move.rook;
737   - board[move.re] = 0;
738   - move.piece_locations.length--;
739   - }
740 734 if (move.ep_position){
741 735 board[move.ep_position] = move.ep_taken;
742 736 }
743 737 board[move.s] = move.S;
744 738 board[move.e] = move.E;
745   - if (move.S & 15)
  739 + move.piece_locations.length--;
  740 + if(move.rs){
  741 + board[move.rs] = move.rook;
  742 + board[move.re] = 0;
746 743 move.piece_locations.length--;
  744 + }
747 745 state.castles = move.castles;
748 746 }
749 747

0 comments on commit c0bcd89

Please sign in to comment.
Something went wrong with that request. Please try again.