This commit is contained in:
gnieark 2016-06-19 23:58:15 +02:00
parent da7b33b711
commit 029a304ab8

View File

@ -277,7 +277,8 @@ switch ($_POST['act']){
'his_strikes' => $_SESSION['strikes'][$opponent] 'his_strikes' => $_SESSION['strikes'][$opponent]
) )
); );
$anwserPlayerJson=get_IA_Response($currentBot['url'],$botParamsToSend); $anwserPlayer=get_IA_Response($currentBot['url'],$botParamsToSend);
$anwserPlayerJson=$anwserPlayer['responseArr'];
if($fullLogs){ if($fullLogs){
$fullLogs='Arena send to '.$currentBot['name'].'<em>'.htmlentities($anwserPlayerJson['messageSend']).'</em><br /> $fullLogs='Arena send to '.$currentBot['name'].'<em>'.htmlentities($anwserPlayerJson['messageSend']).'</em><br />
HTTP status: <em>'.htmlentities($anwserPlayerJson['httpStatus']).'</em><br /> HTTP status: <em>'.htmlentities($anwserPlayerJson['httpStatus']).'</em><br />
@ -287,14 +288,14 @@ switch ($_POST['act']){
} }
if(!preg_match('/^[0-9]+,[0-9]+$/',$anwserPlayerJson['responseArr']['play'])){ if(!preg_match('/^[0-9]+,[0-9]+$/',$anwserPlayerJson['play'])){
echo json_encode(array( echo json_encode(array(
'target' => '', 'target' => '',
'log' => $fullLogs.$currentBot['name']." a fait une réponse non conforme, il perd.")); 'log' => $fullLogs.$currentBot['name']." a fait une réponse non conforme, il perd."));
save_battle('Battleship',$_SESSION['bot1']['name'],$_SESSION['bot2']['name'],$opponent); save_battle('Battleship',$_SESSION['bot1']['name'],$_SESSION['bot2']['name'],$opponent);
die; die;
} }
list($x,$y)=explode(",",$anwserPlayerJson['responseArr']['play']); list($x,$y)=explode(",",$anwserPlayerJson['play']);
//check if shot is under map's limits //check if shot is under map's limits
if(($x >= $_SESSION['width']) OR ($y >= $_SESSION['height'])){ if(($x >= $_SESSION['width']) OR ($y >= $_SESSION['height'])){