From f954e723d625e503373d5aeb80cc225afdb9dd24 Mon Sep 17 00:00:00 2001 From: Gnieark Date: Thu, 2 Jun 2016 17:21:14 +0200 Subject: [PATCH] . --- html/testBotScripts/tictactoe.html | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/html/testBotScripts/tictactoe.html b/html/testBotScripts/tictactoe.html index 8907a09..cec96ee 100644 --- a/html/testBotScripts/tictactoe.html +++ b/html/testBotScripts/tictactoe.html @@ -84,6 +84,7 @@ function playingAT(cellKey){ } //does he win? + //To Do @@ -124,8 +125,15 @@ function play(player){ addLog('his awnser is: ' + xhr.responseTEXT); var reponse = eval(xhr.responseTEXT); + var cellTarget= reponse['play']; + //test format of response - + var reg = '/^[0-2]\-[0-2]$/'; + if (!reg.test(cellTarget)){ + addLog('player ' + p + ' a fait une réponse non conforme: ' + xhr.responseTEXT); + return; + } + playingAT(cellTarget); }else{ addLog('player ' + p + ' n est pas joignable ' + xhr.status);