summaryrefslogtreecommitdiff
path: root/public/move.js
diff options
context:
space:
mode:
authorIgrisBRC <[email protected]>2024-07-17 18:09:36 +0530
committerGitHub <[email protected]>2024-07-17 18:09:36 +0530
commit5123593638f73239de9a1bb1bd287b1d0e87daaf (patch)
tree95d038d23db29777d8f3d433cbcbe64f64c1bcfd /public/move.js
parenta7e11ff8f729a669d8b2445f066606302ecb1b46 (diff)
parent438ad19a536dab544b6071c741ab6107bf63dabb (diff)
Merge pull request #5 from ameliasquires/main
fix castling and cleanliness
Diffstat (limited to 'public/move.js')
-rw-r--r--public/move.js4
1 files changed, 2 insertions, 2 deletions
diff --git a/public/move.js b/public/move.js
index 59badf4..87de976 100644
--- a/public/move.js
+++ b/public/move.js
@@ -168,7 +168,7 @@ function king_move(board, y, x) {
let moves = []
let controlled = controlled_squares(board, to_move)
-
+
for (let i = y - 1; i <= y + 1; i += 1) {
for (let j = x - 1; j <= x + 1; j += 1) {
if ((i == y && j == x) || i < 0 || j < 0 || i >= board.length || j >= board[i].length) {
@@ -179,7 +179,7 @@ function king_move(board, y, x) {
}
}
}
-
+
if (color && castle_white_short && board[7][6] == 0 && board[7][5] == 0) {
for (let i = 0; i < controlled.length; i++) {
if ((controlled[i][0] == 7 && controlled[i][1] == 6) || (controlled[i][0] == 7 && controlled[i][1] == 5)) {