diff --git a/ai-client/target/ai-client-1.0-SNAPSHOT.jar b/ai-client/target/ai-client-1.0-SNAPSHOT.jar index 2c67775..d8ce2e3 100644 Binary files a/ai-client/target/ai-client-1.0-SNAPSHOT.jar and b/ai-client/target/ai-client-1.0-SNAPSHOT.jar differ diff --git a/ai-client/target/maven-archiver/pom.properties b/ai-client/target/maven-archiver/pom.properties index e71fd15..7c34246 100644 --- a/ai-client/target/maven-archiver/pom.properties +++ b/ai-client/target/maven-archiver/pom.properties @@ -1,5 +1,5 @@ #Generated by Maven -#Tue Feb 10 14:54:37 CET 2026 +#Tue Feb 10 14:58:36 CET 2026 artifactId=ai-client groupId=com.lona.tictactoe version=1.0-SNAPSHOT diff --git a/ai-client/target/original-ai-client-1.0-SNAPSHOT.jar b/ai-client/target/original-ai-client-1.0-SNAPSHOT.jar index 95f4740..f971395 100644 Binary files a/ai-client/target/original-ai-client-1.0-SNAPSHOT.jar and b/ai-client/target/original-ai-client-1.0-SNAPSHOT.jar differ diff --git a/client/target/client-1.0-SNAPSHOT.jar b/client/target/client-1.0-SNAPSHOT.jar index b689861..157d359 100644 Binary files a/client/target/client-1.0-SNAPSHOT.jar and b/client/target/client-1.0-SNAPSHOT.jar differ diff --git a/client/target/maven-archiver/pom.properties b/client/target/maven-archiver/pom.properties index f84148e..af8b277 100644 --- a/client/target/maven-archiver/pom.properties +++ b/client/target/maven-archiver/pom.properties @@ -1,5 +1,5 @@ #Generated by Maven -#Tue Feb 10 14:07:26 CET 2026 +#Tue Feb 10 15:00:01 CET 2026 artifactId=client groupId=com.lona.tictactoe version=1.0-SNAPSHOT diff --git a/client/target/original-client-1.0-SNAPSHOT.jar b/client/target/original-client-1.0-SNAPSHOT.jar index 57ceb93..72a6012 100644 Binary files a/client/target/original-client-1.0-SNAPSHOT.jar and b/client/target/original-client-1.0-SNAPSHOT.jar differ diff --git a/web-client/src/main/resources/static/js/app.js b/web-client/src/main/resources/static/js/app.js index d5a1397..66bc6d3 100644 --- a/web-client/src/main/resources/static/js/app.js +++ b/web-client/src/main/resources/static/js/app.js @@ -7,10 +7,29 @@ const joinInput = document.getElementById('join-code'); const displayCode = document.getElementById('display-code'); const turnStatus = document.getElementById('turn-status'); const leaveBtn = document.getElementById('leave-btn'); +const surrenderBtn = document.getElementById('surrender-btn'); +const cells = document.querySelectorAll('.cell'); -// ... (other vars) +// Game State +let mySymbol = ''; +let ws = null; +let currentCode = ''; -// ... +function send(msg) { + if (ws && ws.readyState === WebSocket.OPEN) { + ws.send(msg); + } +} + +// Event Listeners +createBtn.addEventListener('click', () => { + send('CREATE'); +}); + +joinBtn.addEventListener('click', () => { + const code = joinInput.value.trim(); + if (code) send(`JOIN ${code}`); +}); leaveBtn.addEventListener('click', () => { if (confirm('Are you sure you want to leave the lobby?')) { @@ -25,6 +44,15 @@ surrenderBtn.addEventListener('click', () => { } }); +cells.forEach(cell => { + cell.addEventListener('click', () => { + if (!mySymbol) return; + const r = cell.dataset.r; + const c = cell.dataset.c; + send(`MOVE ${r} ${c}`); + }); +}); + // ... function handleMessage(msg) { diff --git a/web-client/target/classes/static/js/app.js b/web-client/target/classes/static/js/app.js index d5a1397..66bc6d3 100644 --- a/web-client/target/classes/static/js/app.js +++ b/web-client/target/classes/static/js/app.js @@ -7,10 +7,29 @@ const joinInput = document.getElementById('join-code'); const displayCode = document.getElementById('display-code'); const turnStatus = document.getElementById('turn-status'); const leaveBtn = document.getElementById('leave-btn'); +const surrenderBtn = document.getElementById('surrender-btn'); +const cells = document.querySelectorAll('.cell'); -// ... (other vars) +// Game State +let mySymbol = ''; +let ws = null; +let currentCode = ''; -// ... +function send(msg) { + if (ws && ws.readyState === WebSocket.OPEN) { + ws.send(msg); + } +} + +// Event Listeners +createBtn.addEventListener('click', () => { + send('CREATE'); +}); + +joinBtn.addEventListener('click', () => { + const code = joinInput.value.trim(); + if (code) send(`JOIN ${code}`); +}); leaveBtn.addEventListener('click', () => { if (confirm('Are you sure you want to leave the lobby?')) { @@ -25,6 +44,15 @@ surrenderBtn.addEventListener('click', () => { } }); +cells.forEach(cell => { + cell.addEventListener('click', () => { + if (!mySymbol) return; + const r = cell.dataset.r; + const c = cell.dataset.c; + send(`MOVE ${r} ${c}`); + }); +}); + // ... function handleMessage(msg) { diff --git a/web-client/target/web-client-1.0-SNAPSHOT.jar b/web-client/target/web-client-1.0-SNAPSHOT.jar index 2dbf650..04cd654 100644 Binary files a/web-client/target/web-client-1.0-SNAPSHOT.jar and b/web-client/target/web-client-1.0-SNAPSHOT.jar differ diff --git a/web-client/target/web-client-1.0-SNAPSHOT.jar.original b/web-client/target/web-client-1.0-SNAPSHOT.jar.original index 6010ee6..096d031 100644 Binary files a/web-client/target/web-client-1.0-SNAPSHOT.jar.original and b/web-client/target/web-client-1.0-SNAPSHOT.jar.original differ