summaryrefslogtreecommitdiff
path: root/public/app.js
diff options
context:
space:
mode:
authorIgrisBRC <[email protected]>2024-07-14 07:52:33 +0530
committerIgrisBRC <[email protected]>2024-07-14 07:52:33 +0530
commit0cb30eae51381c1452112c681548ddb2337590ae (patch)
tree6e3c896343d3485b7a7eea33e7a9f025c6cc53d7 /public/app.js
parenta734e0af70a14dc8d635ab988c82e1a2e0b49836 (diff)
fixed pawn move, used to jump over a piece before
Diffstat (limited to 'public/app.js')
-rw-r--r--public/app.js6
1 files changed, 6 insertions, 0 deletions
diff --git a/public/app.js b/public/app.js
index a8db6b2..8de18e4 100644
--- a/public/app.js
+++ b/public/app.js
@@ -41,6 +41,9 @@ function pawn_move(board, y, x) {
if (board[y - 1][x] == 0) {
moves.push([y - 1, x])
}
+ else {
+ return moves
+ }
if (board[y - 2][x] == 0) {
moves.push([y - 2, x])
}
@@ -54,6 +57,9 @@ function pawn_move(board, y, x) {
if (board[y + 1][x] == 0) {
moves.push([y + 1, x])
}
+ else {
+ return moves
+ }
if (board[y + 2][x] == 0) {
moves.push([y + 2, x])
}