From 2a052cd0f83edcc05eba503606845afbb55b09db Mon Sep 17 00:00:00 2001 From: Thomas de Brettes <thomas.de-brettes@etu.ec-lyon.fr> Date: Wed, 26 Mar 2025 10:08:58 +0100 Subject: [PATCH] =?UTF-8?q?probl=C3=A8me=20de=20accolade?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- htdocs/chess.js | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/htdocs/chess.js b/htdocs/chess.js index be8c110..11fc006 100644 --- a/htdocs/chess.js +++ b/htdocs/chess.js @@ -121,6 +121,7 @@ function highlightMoves(piece, row, col) { } if (noirs.includes(board[row + direction][col - direction])){ moves.push({row: row +direction, col: col - direction }) + } } if (piece.toLowerCase() === "t") { // Déplacements vers le haut @@ -153,7 +154,7 @@ function highlightMoves(piece, row, col) { if (board[row][c] === "") { moves.push({ row, col: c }); } else { - if (noirs.includes(board[r][col])) { + if (noirs.includes(board[row][c])) { moves.push({ row, col: c }); } break; @@ -165,19 +166,16 @@ function highlightMoves(piece, row, col) { if (board[row][c] === "") { moves.push({ row, col: c }); } else { - if (noirs.includes(board[r][col])) { + if (noirs.includes(board[row][c])) { moves.push({ row, col: c }); } break; } } } - - - } return moves; -} + } -- GitLab