summaryrefslogtreecommitdiff
path: root/public/make_move.js
diff options
context:
space:
mode:
authorIgrisBRC <[email protected]>2024-07-16 22:24:49 +0530
committerIgrisBRC <[email protected]>2024-07-16 22:24:49 +0530
commita7e11ff8f729a669d8b2445f066606302ecb1b46 (patch)
tree1f82d5fd3ca3ef6010068f2f0a1985f3f72efbac /public/make_move.js
parent6894b9d9337be6c5c8032e1d1890dc5a7ebdce9b (diff)
added castling ;)
Diffstat (limited to 'public/make_move.js')
-rw-r--r--public/make_move.js24
1 files changed, 18 insertions, 6 deletions
diff --git a/public/make_move.js b/public/make_move.js
index 07211dc..e00b999 100644
--- a/public/make_move.js
+++ b/public/make_move.js
@@ -1,11 +1,23 @@
-function make_move(board, y ,x, new_y, new_x) {
- board[new_y][new_x] = board[y][x]
- board[y][x] = 0
+//function make_move(board, y, x, new_y, new_x) {
+//
+// board[new_y][new_x] = board[y][x]
+// board[y][x] = 0
+//
+// check = check_check(board, to_move, check)
+//
+// if (check) {
+// console.log("check")
+// }
+//}
- check = check_check(board, to_move, check)
+function make_move(board, prev_y_x, new_y_x) {
- if (check) {
- console.log("check")
+ for (let i = 0; i < new_y_x.length; i++) {
+ board[new_y_x[i][0]][new_y_x[i][1]] = board[prev_y_x[i][0]][prev_y_x[i][1]]
+ }
+
+ for (let i = 0; i < prev_y_x.length; i++) {
+ board[prev_y_x[i][0]][prev_y_x[i][1]] = 0
}
}