diff --git a/src/arenas/connectFour/act.php b/src/arenas/connectFour/act.php
index 28c352b..95d50e1 100644
--- a/src/arenas/connectFour/act.php
+++ b/src/arenas/connectFour/act.php
@@ -198,7 +198,7 @@ switch ($_POST['act']){
'strikeX' => $strikeX,
'strikeY' => $strikeY,
'strikeSymbol'=> $you,
- 'log' => $you." ".$currentBotName." a gagné"
+ 'log' => $you." ".$currentBotName." joue colonne ". $anwserPlayer"et a gagné"
);
}else{
$anwserToJS=array(
diff --git a/src/arenas/connectFour/js.js b/src/arenas/connectFour/js.js
index cdf49ea..75f5065 100644
--- a/src/arenas/connectFour/js.js
+++ b/src/arenas/connectFour/js.js
@@ -29,7 +29,6 @@ function connectFour(bot1,bot2,xd_check, newGame){
document.getElementById('fightResult').removeChild(document.getElementById('fightResult').firstChild);
}
//create grid
-
var table=createElem('table',{'class':'battleGrid'});
for (var i=6; i > -1; i--){
var tr=createElem('tr');
@@ -42,28 +41,27 @@ function connectFour(bot1,bot2,xd_check, newGame){
}
document.getElementById('fightResult').appendChild(table);
}
+ //send request
var xhr = Ajx();
xhr.onreadystatechange = function(){if(xhr.readyState == 4){
- if(xhr.status == 200) {
- //for debug
- document.getElementById('logs').innerHTML += xhr.responseText + '
';
+ if(xhr.status == 200) {
try{
var reponse = JSON.parse(xhr.responseText);
}catch(e){
document.getElementById('logs').innerHTML += 'erreur' +xhr.responseText;
return;
- }
-
+ }
+ //log
+ document.getElementById('logs').innerHTML += reponse['log'] + '
';
//fill the grid
-
if( reponse['strikeX'] > -1){
document.getElementById('td' + reponse['strikeX'] + '_' + reponse['strikeY']).innerHTML = reponse['strikeSymbol'];
}
+
+ //if game isn't finished, continue
if(reponse['continue'] == 1){
connectFour(bot1,bot2,xd_check, false);
}
-
-
}else{
alert ('error ' + xhr.status);
return;