dont send full map
This commit is contained in:
parent
fe7905d82c
commit
8caa44abab
|
@ -99,6 +99,8 @@ switch ($_POST['act']){
|
|||
for($y = 0; $_SESSION['map'][$y][$anwserPlayer] <> ""; $y++){
|
||||
}
|
||||
$_SESSION['map'][$y][$anwserPlayer]=$you;
|
||||
$strikeX=$anwserPlayer;
|
||||
$strikeY=$y;
|
||||
|
||||
//does he win?
|
||||
for($i=0;$i < 7;$i++){
|
||||
|
@ -145,24 +147,28 @@ switch ($_POST['act']){
|
|||
if($wins){
|
||||
$anwserToJS=array(
|
||||
'continue' => 0,
|
||||
'grid' => $_SESSION['map'],
|
||||
'strikeX' => $strikeX,
|
||||
'strikeY' => $strikeY,
|
||||
'strikeSymbol'=> $you,
|
||||
'log' => $you." ".$currentBotName." a gagné"
|
||||
);
|
||||
}else{
|
||||
$anwserToJS=array(
|
||||
'continue' => 1,
|
||||
'grid' => $_SESSION['map'],
|
||||
'strikeX' => $strikeX,
|
||||
'strikeY' => $strikeY,
|
||||
'strikeSymbol'=> $you,
|
||||
'log' => $you." ".$currentBotName." joue colonne ". $anwserPlayer
|
||||
);
|
||||
|
||||
|
||||
}
|
||||
|
||||
}else{
|
||||
//reponse non conforme
|
||||
$anwserToJS=array(
|
||||
'continue' =>0,
|
||||
'grid' => $_SESSION['map'],
|
||||
'strikeX' => -1,
|
||||
'strikeY' => -1,
|
||||
'log' => $you." ".$currentBotName." a fait une réponse non conforme, il perd"
|
||||
);
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@ function connectFour(bot1,bot2,xd_check){
|
|||
for (var i=0; i<6; i++){
|
||||
var tr=createElem('tr');
|
||||
for (var j=0;j<7; j++){
|
||||
var td=createElem('td',{'id': 'td' + i + '-' + j});
|
||||
var td=createElem('td',{'id': 'td' + j + '-' + i});
|
||||
tr.appendChild (td);
|
||||
}
|
||||
|
||||
|
@ -43,9 +43,11 @@ function connectFour(bot1,bot2,xd_check){
|
|||
document.getElementById('logs').innerHTML += 'erreur' +xhr.responseText;
|
||||
return;
|
||||
}
|
||||
//alert (reponse['continue']);
|
||||
|
||||
|
||||
//fill the grid
|
||||
if( reponse['strikeX'] > -1){
|
||||
document.getElementById('td' + reponse['strikeX'] + '-' + reponse['strikeY']).innerHTML=reponse['strikeSymbol'];
|
||||
}
|
||||
|
||||
|
||||
}else{
|
||||
|
|
Loading…
Reference in New Issue
Block a user