diff --git a/htdocs/chess.js b/htdocs/chess.js index be8c11094750b698e1efcb51acc82348d5ee5344..11fc00632959032e8e4863fe4542b73ef3eb5479 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; -} + }