From a36105ddbe892261400f359fef4d048537926cac Mon Sep 17 00:00:00 2001 From: Gnieark Date: Tue, 31 May 2016 17:36:07 +0200 Subject: [PATCH] fix js --- html/testBotScripts/tictactoe.html | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/html/testBotScripts/tictactoe.html b/html/testBotScripts/tictactoe.html index 91a153d..b403b0a 100644 --- a/html/testBotScripts/tictactoe.html +++ b/html/testBotScripts/tictactoe.html @@ -70,8 +70,6 @@ function playingAT(cellKey){ for (var index = 0; index < inputs.length; index++) { inputs[index].setAttribute("class","hidden"); } - - document.getElementById("playerButtons").setAttribute("class", "hidden"); if(currentPlayer == 1){ var symbol= "X"; @@ -79,14 +77,10 @@ function playingAT(cellKey){ var symbol="O"; } - //find the first line empty - var i=0; - for(i = 0; i < 6 , grid[i][col] !== ""; i++){ - //nothing juste a counter + //test if cell is empty + if(grid[cellKey] !== ""){ + addLog("Player " + currentPlayer + "tente de jouer sur " + cellKey +". Cette case est déjà prise, il perd"); } - grid[i][col]=symbol; - document.getElementById('td' + col + '_' + i).innerHTML = symbol; - addLog('player ' + currentPlayer + ', symbol ' + symbol + ' played col ' + col); //does he win?