From d3a80a61e1920491bf92a3581ab790737d9f178c Mon Sep 17 00:00:00 2001 From: Thomas de Brettes <thomas.de-brettes@etu.ec-lyon.fr> Date: Tue, 1 Apr 2025 20:38:32 +0200 Subject: [PATCH] Tous les roques --- app.js | 4 ++-- htdocs/index.js | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app.js b/app.js index f4f42ba..c6a6ca9 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 c3a939b..a534d60 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', { -- GitLab