diff --git a/app.js b/app.js index f4f42ba793ed75e37788c64e7823a8ca8b658c9a..c6a6ca9d587c64662f87e1b177f2ec2ca5f6f1b0 100644 --- a/app.js +++ b/app.js @@ -5,7 +5,7 @@ const express = require('express'); const app = express(); const http = require('http').createServer(app); const path = require('path'); -const port = 8060; +const port = 8080; const io = require('socket.io')(http); @@ -70,7 +70,7 @@ io.on('connection', (socket) => { console.log(`[Server] Play reçu : ${JSON.stringify(data)}`); // Debugging socket.broadcast.emit('roque', data); // On diffuse à tous les clients }); - + socket.on('echec', () => { socket.broadcast.emit('echec'); }); diff --git a/htdocs/index.js b/htdocs/index.js index c3a939bbdcfed533b56a373d1a20377da5656ab4..a534d6006801df041390451ae2c260316fcc8c0b 100644 --- a/htdocs/index.js +++ b/htdocs/index.js @@ -501,12 +501,12 @@ function highlightMoves(tour,piece, row, col) { } } if (row==0 && col == 4) {//position roi noir d'origine - if (board[0][3] === "" && board[0][2] ==="" && board[0][1] ==="" && board[0][0] ==="t"){//rock à gauche + if (board[0][3] === "" && board[0][2] ==="" && board[0][1] ==="" && board[0][0] ==="T"){//rock à gauche let newRow = row; let newCol = 2; moves.push({ row: newRow, col: newCol }); } - if (board[0][5] === "" && board[0][6] ==="" && board[0][7] ==="t"){//rock à droite + if (board[0][5] === "" && board[0][6] ==="" && board[0][7] ==="T"){//rock à droite let newRow = row; let newCol = 6; moves.push({ row: newRow, col: newCol }); @@ -736,7 +736,7 @@ function movePiece(piece, newRow, newCol) { to: { x: 7, y: 3 }, // Position d'arrivée piece: "t"} }) - } else { + } else if (player.isBlackPlayer){ board[0][3]="T" board[0][0]="" socket.emit('roque', {