fix
This commit is contained in:
parent
b0f5e6a36e
commit
ea9a3c8118
|
@ -140,19 +140,19 @@ function play(player){
|
||||||
xhr.onreadystatechange = function(){if(xhr.readyState == 4){
|
xhr.onreadystatechange = function(){if(xhr.readyState == 4){
|
||||||
if(xhr.status == 200) {
|
if(xhr.status == 200) {
|
||||||
addLog('message send to bot ' + player + ':' + stringToSend);
|
addLog('message send to bot ' + player + ':' + stringToSend);
|
||||||
addLog('his awnser is: ' + xhr.responseTEXT);
|
addLog('his awnser is: ' + xhr.responseText);
|
||||||
try{
|
try{
|
||||||
var reponse = JSON.parse(xhr.responseTEXT);
|
var reponse = JSON.parse(xhr.responseText);
|
||||||
var cellTarget= reponse['play'];
|
var cellTarget= reponse['play'];
|
||||||
}catch(e){
|
}catch(e){
|
||||||
addLog('player ' + player + ' a fait une réponse non conforme aux specs: ' + xhr.responseTEXT);
|
addLog('player ' + player + ' a fait une réponse non conforme aux specs: ' + xhr.responseText);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
//test format of response
|
//test format of response
|
||||||
var reg = '/^[0-2]\-[0-2]$/';
|
var reg = '/^[0-2]\-[0-2]$/';
|
||||||
if (!reg.test(cellTarget)){
|
if (!reg.test(cellTarget)){
|
||||||
addLog('player ' + player + ' a fait une réponse non conforme: ' + xhr.responseTEXT);
|
addLog('player ' + player + ' a fait une réponse non conforme: ' + xhr.responseText);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
playingAT(cellTarget);
|
playingAT(cellTarget);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user