diff options
author | IgrisBRC <[email protected]> | 2024-07-15 15:35:35 +0530 |
---|---|---|
committer | IgrisBRC <[email protected]> | 2024-07-15 15:35:35 +0530 |
commit | 26619e4353d551bb4e2a79059203a26c3f5f5647 (patch) | |
tree | fcf8e8e0a95536640a79f1086e982923a25d05a2 /public/move.js | |
parent | ce46cd25a35a11343f46a9caa0bf1af64600d941 (diff) |
all the bugs so far have been fixed, black pawns move twice, and the highlighting does get cancelled when it should
Diffstat (limited to 'public/move.js')
-rw-r--r-- | public/move.js | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/public/move.js b/public/move.js index ee527c6..5dc49af 100644 --- a/public/move.js +++ b/public/move.js @@ -12,7 +12,7 @@ let board = [ let to_move = true //white to move //console.log(board[7][1]) -//console.log(move(board, 7, 1, to_move)) +//console.log(move(board, 3, 1, to_move)) function move(board, y, x, to_move) { if (to_move ^ board[y][x] > 0) { @@ -69,9 +69,10 @@ function pawn_move(board, y, x) { if (board[y + 2][x] == 0) { moves.push([y + 2, x]) } - } else if (color && y != 7 && board[y + 1][x] == 0) { + } else if (!color && y != 7 && board[y + 1][x] == 0) { moves.push([y + 1, x]) } + return moves } } |